TastyWheat
Registered User.
- Local time
- Today, 14:51
- Joined
- Dec 14, 2005
- Messages
- 125
After I close Access (via the 'X' or 'Exit') I still see MSACCESS.EXE in my process list. This only happens when I run this piece of code:
This isn't an extra process that's being created. This is the same process from open to close. It just doesn't close when I tell it to.
Code:
Public Function GetEmployeeStore(lngEmployee As Long) As Long
On Error GoTo GetEmployeeStore_Error
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strSQL As String
Dim strTable As String
Set conn = CurrentProject.Connection
strTable = "[Store Change]"
strSQL = "SELECT TOP 1 * " & _
"FROM " & strTable & " " & _
"WHERE EmployeeID = " & lngEmployee & " " & _
"ORDER BY EffectiveDate Desc;"
Set rs = conn.Execute(strSQL)
GetEmployeeStore = rs("NewStoreID")
GetEmployeeStore_End:
If Not (rs Is Nothing) Then
If (rs.State = adStateOpen) Then
rs.Close
End If
End If
Set acc = Nothing
Set rs = Nothing
Set conn = Nothing
Exit Function
GetEmployeeStore_Error:
Debug.Print Err.Description & " (" & Err.Number & ")"
GoTo GetEmployeeStore_End
End Function