Whereismyhammer
Technical User
I am trying to create a command button in ArcMap 9.3.1 that closes any MS Access applications that are currently open. The code works fine the fist time it is run but if I try to run it a second time I get the following error:
"Run-time error '462': The remote server machine does not exist or is unavailable."
I have tried to resolve the problem and think it has to do with non-explicit referencing but I can't find where the non-explicit reference is located. My code is actually longer and does more than just close Access but the error seems to arise with this procedure. I have isolated each procedure of my code and only get the error for this one. I am very new to programming so any guidance people can provide will be greatly appreciated.
Private Sub QuitAccess_Click()
'Create the Access object
Dim oAccess As Access.Application
Set oAccess = Access.Application
'Quit Access
oAccess.Quit '<--This is where the error occurs the second time the code is run
'Release Access Object
Set oAccess = Nothing
End Sub
"Run-time error '462': The remote server machine does not exist or is unavailable."
I have tried to resolve the problem and think it has to do with non-explicit referencing but I can't find where the non-explicit reference is located. My code is actually longer and does more than just close Access but the error seems to arise with this procedure. I have isolated each procedure of my code and only get the error for this one. I am very new to programming so any guidance people can provide will be greatly appreciated.
Private Sub QuitAccess_Click()
'Create the Access object
Dim oAccess As Access.Application
Set oAccess = Access.Application
'Quit Access
oAccess.Quit '<--This is where the error occurs the second time the code is run
'Release Access Object
Set oAccess = Nothing
End Sub