here's a piece of my code:
Dim ltime, ldate As Date ltime = TimeValue(Now) ldate = DateValue(Now) query = "INSERT INTO UserLog(username, accessLevel, loginTime, logDate) ''' VALUES('" & username1 & "', '" & accessLevel1 & "', '" & ltime & "', '" & ldate & " ')" db.Execute (query) db.Close
notice that there's no logoutTime in the above code.
what should i do in order to specify the last row so that i can insert then the logoutTime.
by the way, this logoutTime is triggered by the event terminate event, that is, whenever the application stops or closes.
here's the code for logoutTime
Dim ltimeout As Date ltimeout = TimeValue(Now) Call connectdb Dim rs1 As String rs1 = "SELECT * FROM UserLog WHERE UserID = (SELECT max(UserID) FROM UserLog)" query = "INSERT INTO UserLog(logoutTime) VALUES('" & ltimeout & "') WHERE UserID= '" & rs1 & "')" db.Execute (query) db.Close
thanks in advance