
Execute Code on Application Exit?
The usual method is to open a hidden form at startup and put your
"application exit" code in the Close event of that form. Leave the
form open while the application is open. When the user closes the
application, Access closes all open forms, including your hidden form,
so the code runs at that time.
By the way, you cross-posted your question to *way* too many unrelated
newsgroups. Please try to be more selective.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
Quote:
> Basically all I want to do is write to a log file, when a
> user enters or exits my access database, recording
> username and time logged on/off to the Access database.
> My problem is I do not know how I can perform code
> execution if the user closes Access from the Quit
> Application click box on the Main Menu bar. I easily can
> have my code executed with a command button for Quit
> Application. But for those users who bypass the command
> button and use Application Close box on the menu bar, I
> can seem to figure how to execute this code for that
> action. Most people just close out the Access database
> rather than use the Quit Command button I have on my main
> form.
> Anyone have any ideas?
> Thanks.
> William