Hi folks
I want to capture the "Exit" event when the user closes the DB (click on the X on top right side of the window, or use file exit.
Any feedback would be appreciated very much.
Thanks
Mike
Hi folks
I want to capture the "Exit" event when the user closes the DB (click on the X on top right side of the window, or use file exit.
Any feedback would be appreciated very much.
Thanks
Mike
There is no easy way, unfortunately to capture this event.
If you have 2007 or 2010 installed, you can alter the home tab with some work and XML so they might not be able to exit from there, and I saw this article on the web from disabling the 'X' button on the upper-right hand side. http://www.fmsinc.com/microsoftacces...eventclose.asp
(I never tested this article out myself yet). Then of course, you would provide you own way to exit the program using something like the DoCmd.Quit function with whatever other code you wanted to run first.
Something that I have done, which isn't 100% reliable, but if you are working on a project that is locked down from the user perspective and has a form that they can't close (like a menu) or a hidden form that is up all the time, you can but code into the close even of that form. That will fire when you close the program. I track some user information this way and it works pretty well. Of course, from a professional perspective, pretty well isn't always good enough...
Just some ideas.
Hi Drexasaurus
Thank you for the quick reply and the reference. I will certainly check it.
Mike
Actually there is a very easy way to capture and maybe stop that application Exit event. Use the AutoExec macro to load a hidden form at the start of the application. This form will then be the last to close when the user quits the application. I use this form for a number of housekeeping chores. It starts my persistant connection and allows me to kick everyone off if I need to do maintenance. It also does any cleanup necessary when the application closes, like deleting any temporary db I may have used. It can also cancel the closing if the application if something needs to be completed before close.