What is the best way to safely terminate an Access application thru VBA code?
Thanks,
Blake
Printable View
What is the best way to safely terminate an Access application thru VBA code?
Thanks,
Blake
If its opened through VBA then is there another DB thats open too? How did you open the db from VBA when you need to
have a db opened first?
Are you talking about safely closing or abruptly terminating?Quote:
Originally Posted by blakemckenna
If you are talking about abruptly terminating, then I assume you will be running Access VBA code from one database, but wanting to terminate the running instance of another database, correct?
When my Access app is finished processing all of the code....the very last thing I want to do is end the application. I tried doing this with the "End" command and it comes back with a window in which I need to select "Halt". When I use the myApp.Quit object, my program seems to loop. How should I handle this?
Thanks,
Blake
You need to close all recordsets (if any) and set to nothing. Then close any connection objects and set to nothing. Then close the
db using the AOM.
What is AOM?
Access Object Model
Rob,
What is the syntax for closing the AOM?
Thanks,
Blake
Should be something like I described and ..
VB Code:
'Close and destroy all your other objects. 'Then... oApp.CloseCurrentDatabase oApp.Quit Set oApp = Nothing
Cool...
Thanks Rob!!!
No prob, but note that the oApp object is your variable object that you created when you opened the db if you did it that way.
Else its just the Application object.