K
Keith
Greetings:
I was looking at the task manager and just noticed that Access isn't
really closing when I exit my application. One copy of Access shows up
in the processes list for each time I open and close the application.
(It doesn't appear in the applications list.)
I've read dozens of posts about the merits of DoCmd.Quit v.
Application.Quit, closing recordsets and setting their variables =
Nothing. No matter what I do, Access remains open in the background.
Here are the significant parts of my code:
Private Sub cmdQuit_Click()
DoCmd.Close acForm, "frmMenuMain", acSaveYes
End Sub
On Error Resume Next
gstrSQL = "DELETE * FROM tblCurrUserProj" _
& " WHERE strUserID = """ & fOSUserName() & """;"
DoCmd.SetWarnings False
DoCmd.RunSQL gstrSQL
DoCmd.SetWarnings True
Dim AnObj As Object
'Close all forms
For Each AnObj In Application.Forms
DoCmd.Close acForm, AnObj.Name
Next
'Close all reports
For Each AnObj In Application.Reports
DoCmd.Close acReport, AnObj.Name
Next
'Close all modules
For Each AnObj In Application.Modules
DoCmd.Close acModule, AnObj.Name
Next
'Close any possible object variables.
Set AnObj = Nothing
Set rs = Nothing
'In case the OS needs to do something...
'Tried with and without
DoEvents
DoCmd.Quit acQuitSaveAll 'Tried prompt, too.
End Sub
Is there any way to tell programatically if I have any latent object
variables? If so, how? (Nothing shows up in the locals window.)
Is it possible to set object variables to Nothing outside their scope.
(I suspect not, but since they persist, I thought I'd ask.)
I have 3 hunks of code that I didn't write, and I'm reluctant to start
messing with them. (MouseHook changes scrolling behavior, GetWinUser
gets the currently logged in user, and QBSDK retrieves data from
QuickBooks.) I assumed they were well behaved, but maybe not.
Isn't there any way to just tell Access, "Whatever you think you're
doing, stop right now and exit?" TIA.
Keith
P.S. Did I mention the boss is expecting this at lunch time?
I was looking at the task manager and just noticed that Access isn't
really closing when I exit my application. One copy of Access shows up
in the processes list for each time I open and close the application.
(It doesn't appear in the applications list.)
I've read dozens of posts about the merits of DoCmd.Quit v.
Application.Quit, closing recordsets and setting their variables =
Nothing. No matter what I do, Access remains open in the background.
Here are the significant parts of my code:
Private Sub cmdQuit_Click()
DoCmd.Close acForm, "frmMenuMain", acSaveYes
End Sub
On Error Resume Next
gstrSQL = "DELETE * FROM tblCurrUserProj" _
& " WHERE strUserID = """ & fOSUserName() & """;"
DoCmd.SetWarnings False
DoCmd.RunSQL gstrSQL
DoCmd.SetWarnings True
Dim AnObj As Object
'Close all forms
For Each AnObj In Application.Forms
DoCmd.Close acForm, AnObj.Name
Next
'Close all reports
For Each AnObj In Application.Reports
DoCmd.Close acReport, AnObj.Name
Next
'Close all modules
For Each AnObj In Application.Modules
DoCmd.Close acModule, AnObj.Name
Next
'Close any possible object variables.
Set AnObj = Nothing
Set rs = Nothing
'In case the OS needs to do something...
'Tried with and without
DoEvents
DoCmd.Quit acQuitSaveAll 'Tried prompt, too.
End Sub
Is there any way to tell programatically if I have any latent object
variables? If so, how? (Nothing shows up in the locals window.)
Is it possible to set object variables to Nothing outside their scope.
(I suspect not, but since they persist, I thought I'd ask.)
I have 3 hunks of code that I didn't write, and I'm reluctant to start
messing with them. (MouseHook changes scrolling behavior, GetWinUser
gets the currently logged in user, and QBSDK retrieves data from
QuickBooks.) I assumed they were well behaved, but maybe not.
Isn't there any way to just tell Access, "Whatever you think you're
doing, stop right now and exit?" TIA.
Keith
P.S. Did I mention the boss is expecting this at lunch time?