S
Sandspirit
I am trying to capture the log on/off times for users. I have created a
History table with the fields autoid (autonumber), username, login
time, logout time. I have created a form that has the following VBA
for the Open property. It captures the CurrentUser and the Login time
as now(). The problem I am having is the Log out time. I want the
system to match up the record that has already been created from the
login and just add the Log out time without creating another record,
but to just fill in the Log out Field. I have tried the following
syntax at the Form_Close() propertybut it keeps giving me a syntax
error that the ";" is missing. I have tried putting the ";" literally
everywhere but to no avail.
The syntax for the Form_Close()
Private Sub Form_Close()
Dim sSQL As String
sSQL = "INSERT INTO LogHistory (LogOut) VALUES (now())"
sSQL = sSQL + " where (loghistory.username) = CurrentUser"
DBEngine(0)(0).Execute sSQL
End Sub
The Form_Open() syntax is..
Private Sub Form_Open(Cancel As Integer)
Dim sSQL As String
sSQL = "INSERT INTO LogHistory (UserName,LogIn) VALUES (""" &
CurrentUser & """, now())"
DBEngine(0)(0).Execute sSQL
End Sub
PLEASE HELP!
Thank you!
Sandspirit
History table with the fields autoid (autonumber), username, login
time, logout time. I have created a form that has the following VBA
for the Open property. It captures the CurrentUser and the Login time
as now(). The problem I am having is the Log out time. I want the
system to match up the record that has already been created from the
login and just add the Log out time without creating another record,
but to just fill in the Log out Field. I have tried the following
syntax at the Form_Close() propertybut it keeps giving me a syntax
error that the ";" is missing. I have tried putting the ";" literally
everywhere but to no avail.
The syntax for the Form_Close()
Private Sub Form_Close()
Dim sSQL As String
sSQL = "INSERT INTO LogHistory (LogOut) VALUES (now())"
sSQL = sSQL + " where (loghistory.username) = CurrentUser"
DBEngine(0)(0).Execute sSQL
End Sub
The Form_Open() syntax is..
Private Sub Form_Open(Cancel As Integer)
Dim sSQL As String
sSQL = "INSERT INTO LogHistory (UserName,LogIn) VALUES (""" &
CurrentUser & """, now())"
DBEngine(0)(0).Execute sSQL
End Sub
PLEASE HELP!
Thank you!
Sandspirit