Database Unload Event?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to put some code in the database's "unload event" (is there a
such thing) that could run like a failsafe? i.e. One key event that would
trigger the user being properly logged off, or any other appropriate closing
procedure?
 
jonefer said:
Is it possible to put some code in the database's "unload event" (is there a
such thing) that could run like a failsafe? i.e. One key event that would
trigger the user being properly logged off, or any other appropriate closing
procedure?


No such event.

The usual way to catch the closing of the db is to use the
Unload event of a form that is always open (even if it's not
visible). If you have a mian control or switchboard type of
form, that would be a good candidate for the code.
 
Marshall said:
jonefer wrote:





No such event.

The usual way to catch the closing of the db is to use the
Unload event of a form that is always open (even if it's not
visible). If you have a mian control or switchboard type of
form, that would be a good candidate for the code.

To expand on Marshall's answer you can set your .mdb to open a form upon
Startup (Tools, Startup) and make that form hidden (.Visible = False).

Since it is the first form opened, it will be the last one closed. Use
that Form's OnClose event to execute code you want executed when the
database app is closed.

You can (obviously) use this form's OnLoad event to execute code at
startup as well.
 
Jonefer

To expand on John's comments, I think you will find it is preferable to
use an AutoExec macro if you want a hidden form at startup, rather than
via Tools|Startup menu. Also, in most cases I would recommend the
form's Unload event rather than the Close event, for one thing it gives
you the facility to cancel the close if any conditions are not satisfied.
 
Steve said:
Jonefer

To expand on John's comments, I think you will find it is preferable to
use an AutoExec macro if you want a hidden form at startup, rather than
via Tools|Startup menu. Also, in most cases I would recommend the
form's Unload event rather than the Close event, for one thing it gives
you the facility to cancel the close if any conditions are not satisfied.

Thanks Steve - valuable insight - thanks.
 
Back
Top