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.
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.