Click to See Complete Forum and Search --> : Terminating an Access Application?
blakemckenna
May 31st, 2005, 02:10 PM
What is the best way to safely terminate an Access application thru VBA code?
Thanks,
Blake
RobDog888
May 31st, 2005, 02:12 PM
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?
Hack
May 31st, 2005, 02:15 PM
What is the best way to safely terminate an Access application thru VBA code?
Thanks,
BlakeAre you talking about safely closing or abruptly terminating?
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?
blakemckenna
May 31st, 2005, 02:31 PM
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
RobDog888
May 31st, 2005, 02:34 PM
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.
blakemckenna
May 31st, 2005, 02:54 PM
What is AOM?
RobDog888
May 31st, 2005, 03:00 PM
Access Object Model
blakemckenna
May 31st, 2005, 03:08 PM
Rob,
What is the syntax for closing the AOM?
Thanks,
Blake
RobDog888
May 31st, 2005, 03:37 PM
Should be something like I described and ..
'Close and destroy all your other objects.
'Then...
oApp.CloseCurrentDatabase
oApp.Quit
Set oApp = Nothing
blakemckenna
May 31st, 2005, 03:40 PM
Cool...
Thanks Rob!!!
RobDog888
May 31st, 2005, 03:46 PM
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.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.