Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting database closing 1

Status
Not open for further replies.

PeDa

Technical User
Oct 10, 2002
227
NL
I want to log users starting and leaving the database. I undertand the standard way to detect closure of a database is to load a hidden form at startup and include an Unload event for that form, however this does not work for me.
At startup I include
Code:
DoCmd.OpenForm "frmDatabaseIsInUse", acNormal, , , , acHidden

This contains
Code:
Private Sub Form_Unload(Cancel As Integer)
Call mod_ExecuteMyCommand("INSERT INTO tbLog VALUES(" & Str(pubAuditor_i) & ",'" & Format(Now, "yyyy-mm-dd hh:NN:ss") & "','Application closed')")
DoCmd.Quit
End Sub

mod_ExecuteMyCommand() is a working procedure.
 
I am almost certain that it will work on close. To be honest I do not think I have ever used unload to have any thoughts about when it does or does not fire.
 
>I am almost certain that it will work on close.

Yes indeed; Close works where Unload does not. Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top