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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Log data when database closes

Status
Not open for further replies.

tomass

IS-IT--Management
Apr 28, 2005
2
SK
Hi,

I want to keep track of a database usage. When the user starts the database I record on an array his/her ID and the date and time.

I want to record the date and time when the database is closed and write it to a text file.

I tried to do it by setting some functions at the beginning that would do the first part, and for the second part, I tried to used the onClose of a hidden form, but if the user closes the database directly from the control box (X in the top right corner) the code will not run.

How can I do it?

Thanks,

Thomass
 
Trap the event like this:

Private Sub Form_Unload(Cancel As Integer)
Dim resp
resp = MsgBox("Close", vbYesNo)
If resp = vbYes Then
Cancel = False
'Insert your code here
Else
Cancel = True
End If
End Sub Tyrone Lumley
augerinn@gte.net
 
It works, thanks, Databaseguy.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top