G
Guest
I need to right a Sign Off procedure to update a record when the user signs
off. The record structure is as follows:
ID Autonumber
UserID String
LogIn Date/Time
LogOff Date/Time
I already have a SignIn procedure that works as follows:
Function AddtoSignOnHistory()
On Error GoTo Err_AddtoSignonHistory
Dim strUser As String
Dim mydbase As Database
Dim rs As Recordset
Set mydbase = CurrentDb
Set rs = mydbase.OpenRecordset("tbl_SignOn")
strUser = Environ$("username")
rs.AddNew
rs![User] = strUser
rs![LogIn] = Now
rs.Update
rs.Close
Exit_AddtoSignonHistory:
Exit Function
Err_AddtoSignonHistory:
MsgBox Err.Description
Resume Exit_AddtoSignonHistory
End Function
My SignOff procedure should find the most recent record that matches the
UserID who is signing off and where Login is NotNull and LogOff is Null.
Any suggestions/sample code would be appreciated.
Thanks.
off. The record structure is as follows:
ID Autonumber
UserID String
LogIn Date/Time
LogOff Date/Time
I already have a SignIn procedure that works as follows:
Function AddtoSignOnHistory()
On Error GoTo Err_AddtoSignonHistory
Dim strUser As String
Dim mydbase As Database
Dim rs As Recordset
Set mydbase = CurrentDb
Set rs = mydbase.OpenRecordset("tbl_SignOn")
strUser = Environ$("username")
rs.AddNew
rs![User] = strUser
rs![LogIn] = Now
rs.Update
rs.Close
Exit_AddtoSignonHistory:
Exit Function
Err_AddtoSignonHistory:
MsgBox Err.Description
Resume Exit_AddtoSignonHistory
End Function
My SignOff procedure should find the most recent record that matches the
UserID who is signing off and where Login is NotNull and LogOff is Null.
Any suggestions/sample code would be appreciated.
Thanks.