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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run code as database quits?? 1

Status
Not open for further replies.

jgdillon

MIS
Jan 18, 2001
2
GB
Hi everyone,

Had anyone got a way of running a macro or VBA as the database is exiting. I know I could make a button for quiting and stick the VBA in there, but users could still press the "X" to close and bypass it.

Any ideas welcomed!

 
You can create a form with nothing on it, and have it open up on Startup (Tools menu, then Startup...). Use the form's Open Event to set it's Visible property to False (i.e. Me.Visible = False) - (you can also use this event to open another form that you may already need to open on Startup). The form will be open but not visible or useable while the database is up. Use the form's Exit Event to execute the code that you wish to run when the database is closed. The user nevers sees or interacts with the form. True, it does reside in memory while the database is open, however, since it has nothing on it, and very little code associated with it, it won't make much difference.

Hope this helps,
JW.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top