I have a user login form on my database and I want to force the end user to enter a new password if the password that they have typed in is equal to the 'apwd' column in the table for that user. I am using the code below on the AfterUpdate event of the login name box to go to the table and lookup the user that is trying to log in and then compare the password textbox value on the form to the 'apwd' column in the table. If the password textbox value and the 'apwd' value in the user table is equal or the 'pwd' column value for that user is null, then the new password textbox will become visible on the form with a message box telling the user to enter a new password.
If Me.txtpwd.Value = DLookup("apwd", "Users", "[ID]=" & Me.Cbologinname.Value) Then
MsgBox "You must enter a new password.", vbExclamation + vbOKOnly, "Invalid Password"
I get this error when I run the code:
Run-time error 3075: syntax error (missing operator) in query expression 'apwd'
Can someone tell me what I am doing wrong?