Hello.
In my Access form, I'm using an ADO connection that I disconnect after I grab the data. The form allows you to filter data. In the filter code, I make a ODBC call again to grab the filtered recordset. On two of the dropdowns, the process status is 'sleeping' once it's done getting the data, but the 3rd stays 'runnable'. The 3rd dropdown is also the primary key of the table. The code behind all 3 dropdowns is near exactly the same so I dont' know why it behaves this way.
The table looks vaguely like this:
DataFiles (table)
----------
fileID (primary key)
name
employee
The dropdowns are comboboxes with 2 events. Here is the code
'criteria' is a global variable that stores already selected filters.
The dropdowns for the other 2 variables have the exact same code with different where statements yet, when fileID is clicked the SQL Server process stays runnable and the other two turn to 'sleeping'. Any idea on what's wrong?
In my Access form, I'm using an ADO connection that I disconnect after I grab the data. The form allows you to filter data. In the filter code, I make a ODBC call again to grab the filtered recordset. On two of the dropdowns, the process status is 'sleeping' once it's done getting the data, but the 3rd stays 'runnable'. The 3rd dropdown is also the primary key of the table. The code behind all 3 dropdowns is near exactly the same so I dont' know why it behaves this way.
The table looks vaguely like this:
DataFiles (table)
----------
fileID (primary key)
name
employee
The dropdowns are comboboxes with 2 events. Here is the code
Code:
fileID_click()
On Error Resume Next
Dim sConn
Dim cn
Dim rs
sConn = "ODBC;DSN=CompanySQL;UID=sa;PWD=;DATABASE=FileInventory"
Set cn = New ADODB.Connection
With cn
.Provider = "MSDASQL"
.Properties("Data Source").Value = sConn
.Open
End With
sConn = "SELECT [DataFiles].* FROM [DataFiles] where " & [Form_FILELIST].criteria & "
Set rs = New ADODB.Recordset
With rs
Set .ActiveConnection = cn
.Source = sConn
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.CursorLocation = adUseClient
.Open
End With
Set rs.ActiveConnection = Nothing
cn.Close
Set Me.Recordset = rs
Set cn = Nothing
rs.Close
Set rs = Nothing
If [Form_FILELIST].criteria <> "" Then [Form_FILELIST].criteria = [Form_FILELIST].criteria & " and "
[Form_FILELIST].criteria= [Form_FILELIST].criteria & "[fileID] like '" & fileID.Value & "'"
[Form_FILELIST].Filter = [Form_FILELIST].criteria
[Form_FILELIST].FilterOn = True
End Sub
Private Sub fileID_Enter()
fileID.RowSource = "SELECT distinct fileID FROM [DataFiles] "
If [Form_FILELIST].criteria <> "" Then fileID.RowSource = fileID.RowSource & " where " & [Form_FILELIST].criteria
fileID.RowSource = fileID.RowSource & " order by fileID "
End Sub
'criteria' is a global variable that stores already selected filters.
The dropdowns for the other 2 variables have the exact same code with different where statements yet, when fileID is clicked the SQL Server process stays runnable and the other two turn to 'sleeping'. Any idea on what's wrong?