Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run macro(s) on exit from Access?

Status
Not open for further replies.

WaltW

MIS
Jun 14, 2000
130
US
I "inherited" an Access 2000 database that I'm now supporting. Whenever I exit this particular database, it appears to try to run one or more macros that get errors. But I haven't been able to determine how Access knows to run a macro on exit - I've never seen this before. Can somebody give me some pointers? Where do I go in Access 2000 to find out what macro is being run when you exit the database? Thanks!

Walt Wright
 
WaltW,

Since you appear to be shooting in the dark, you need to consider several ways to find out what macro is running on the exit. I am not aware that Access has any kind of AutoExec feature that wil run upon closing the application. Typically, if you want soem action to take place when the application is shutting down, you set that action to run when during the OnCLiose event of one of the forms that will be open. Start by checking the OnClose events of forms that are open when you close the App.

If that does not give you the answer, try inserting a MsgBox action as the first action in any Macros (I don't mean VB Code, I mean macros listed on the Macros tab on the Database Window). In the Message argument for the action, put the name of the macro. This will stop the macro from running until you click something which will tell which macro (or macros) run on closing the App. This is a crude way to go but it should achieve the first part of the desired result.

Let us know how that works out.
 
Is there a macro named AutoExit - this is something that Word recognizes as a macro to run when exiting, so maybe Access does the same thing????
 
Found it. Turns out there was a menu form that always opens on startup of this particular database. This form does have a macro listed in the "On Close" event, which is the source of the problems I'm having when I exit the database. For some reason I hadn't made the connection that when I close the database without closing the form first, it still has to close that form, so it still tried to run the macro.

Thanks for your help!

WaltW
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top