Process Lingers After Code Execution

T

TastyWheat

I have a function inside a module. It's a pretty standard lookup
function and I've used very similar code in all of my databases. For
some reason, everytime I run the code my process (MSACCESS.EXE) doesn't
finish on its own. I click the 'X' or select 'Exit' and the window
goes away. The only way I can kill the process is to use the task
manager. Here's my 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 * " & _
"FROM " & strTable & ";"
Set rs = New ADODB.Recordset
Set rs.ActiveConnection = conn
rs.CursorType = adOpenStatic
rs.Source = strSQL
rs.Open

GetEmployeeStore = rs("NewStoreID")

GetEmployeeStore_End:
If Not (rs Is Nothing) Then
If Not (rs.State = adStateClosed) Then
rs.Cancel
rs.Close
End If
End If
Set acc = Nothing
Set rs = Nothing
Set conn = Nothing

Exit Function
GetEmployeeStore_Error:
GoTo GetEmployeeStore_End
End Function
===============================
 
T

TastyWheat

Well, the problem is that it steps through the code just fine. You
wouldn't know that anything was wrong until you close the program and
see it still running in the process list.

I don't know if this could have anything to do with it, but my database
is a secured database. Also, the module I'm running this code from was
created after the database was secured.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top