How to trap Microsoft Access Exit event

  • Thread starter Thread starter Tony_VBACoder
  • Start date Start date
T

Tony_VBACoder

With Access 2002, is there a way to trap the event if the
user "kills" Access via Task Manager's "End Task"? I have
code that logs the time when a user logs out of my
application via an "ExitApp" function that I have coded
into my Exit routine, but I don't know how I can trap the
Exit event of Access so that I can log the time the user
logged out by "killing" the app.
 
Tony_VBACoder said:
With Access 2002, is there a way to trap the event if the
user "kills" Access via Task Manager's "End Task"? I have
code that logs the time when a user logs out of my
application via an "ExitApp" function that I have coded
into my Exit routine, but I don't know how I can trap the
Exit event of Access so that I can log the time the user
logged out by "killing" the app.

I doubt that any code in your application will run if the user kills the
process via Task Manager. The user should never do this unless the
application is hung, of course. If you really, really need to track the
time the application stops, the best suggestion I could make -- and not
one I really recommend -- is to use the Timer event of a (possibly
hidden) form to update a date/time field in a table on regular, small
intervals. That way, anything that stops that event from running, such
as closing the app or killing it, will leave the field set to something
very close to the "last active time".
 
Tony,
If you simply have a hidden form that you open when your application
starts, you can then log the user's logout time using the form's
Unload event, which will fire when Access is shutting down and the
form is automatically closed by Access.
-Tom
 
tom said:
Tony,
If you simply have a hidden form that you open when your application
starts, you can then log the user's logout time using the form's
Unload event, which will fire when Access is shutting down and the
form is automatically closed by Access.
-Tom

But the point is, that won't happen if the user kills Access from the
Task Manager.
 
Back
Top