P
PJFry
I am developing a database and I would like to have the time that the user
exits recorded. I already have a login script that records their network
name and the time they logged in.
I started by putting an update SQL on the unload event of a hidden form that
is always open, but that didn't work.
Here is the code for recording the logout:
Private Sub Form_Unload(Cancel As Integer)
'Records the logout time.
Dim cID As Long
cID = DMax("ID", "tLog", "txtUserName='" & fOSUserName() & "'")
strSQL = "UPDATE tLOG SET dtmLogout = '" & Now() & "' WHERE ID = " & cID
DoCmd.RunSQL strSQL
End Sub
The code runs fine if I manually exit the form. But when the form is forced
closed because the database is closing, I don't have any luck. Where is the
proper place to code this so it will fire when the database shuts down?
Thanks!
PJ
exits recorded. I already have a login script that records their network
name and the time they logged in.
I started by putting an update SQL on the unload event of a hidden form that
is always open, but that didn't work.
Here is the code for recording the logout:
Private Sub Form_Unload(Cancel As Integer)
'Records the logout time.
Dim cID As Long
cID = DMax("ID", "tLog", "txtUserName='" & fOSUserName() & "'")
strSQL = "UPDATE tLOG SET dtmLogout = '" & Now() & "' WHERE ID = " & cID
DoCmd.RunSQL strSQL
End Sub
The code runs fine if I manually exit the form. But when the form is forced
closed because the database is closing, I don't have any luck. Where is the
proper place to code this so it will fire when the database shuts down?
Thanks!
PJ