brewpedals
Registered User.
- Local time
- Today, 11:52
- Joined
- Oct 16, 2002
- Messages
- 32
I have a table nameed Users whose Primary Key is a AutoNumber field named UserID and a boolean field named LoggedIn4 that tracks wheter the user is logged in to the application.
I want to log the user off when they exit the application using the following code, but I either get a data type error, or it fails to execute the SQL Statement.
I have tried:
- Declaring strUserID as String, Integer, Long and Double
- Useing the following syntax for the criteria in the SQL
'" & strUSerID & "'
'strUserID'
' & strUserID & '
- Originally, I used DoCmd.OpenQuery to call a query definition, but it ocationally failed to find the value in Forms!DetectIdleTime.UserID.Value. This is a form where I store the user id in an unbound control. Should I be storing it in a global variable? How?
Any help is appreciated.
I want to log the user off when they exit the application using the following code, but I either get a data type error, or it fails to execute the SQL Statement.
I have tried:
- Declaring strUserID as String, Integer, Long and Double
- Useing the following syntax for the criteria in the SQL
'" & strUSerID & "'
'strUserID'
' & strUserID & '
- Originally, I used DoCmd.OpenQuery to call a query definition, but it ocationally failed to find the value in Forms!DetectIdleTime.UserID.Value. This is a form where I store the user id in an unbound control. Should I be storing it in a global variable? How?
Any help is appreciated.
Code:
Dim strSQL As String
Dim strUserID As Integer
strUserID = Forms!DetectIdleTime.UserID.Value
strSQL = "UPDATE Users SET Users.LoggedIn4 = 0 " & _
"WHERE Users.ID= 'strUserID'"
DoCmd.RunSQL strSQL
Last edited: