crisis2007
Technical User
I would like to have a user id checked. If the user id is in the table, then the user access number is changed to 2. If the user is not in the table, a message box appears stating they are not authorized. However I keep getting an error message stating, "Object doesn't support this property or method." I am using Access 2007 if that matters. I found the code and tried to adapt it to my database. Any help is greatly appreciated!
Dim db As Database
Dim sql As String
Dim rst As Recordset
Dim valid_user as Integer
Set db = CurrentDb
sql = "SELECT * FROM T_Employee WHERE UserID = Me.user_id"
Set rst = db.OpenRecordset(sql)
If rst.EOF And rst.BOF Then
MsgBox "Access to this application is not authorized"
valid_user = 0
Exit Sub ' Not a valid user
Else
valid_user = 2
End If
Dim db As Database
Dim sql As String
Dim rst As Recordset
Dim valid_user as Integer
Set db = CurrentDb
sql = "SELECT * FROM T_Employee WHERE UserID = Me.user_id"
Set rst = db.OpenRecordset(sql)
If rst.EOF And rst.BOF Then
MsgBox "Access to this application is not authorized"
valid_user = 0
Exit Sub ' Not a valid user
Else
valid_user = 2
End If