I am not sure since I do this a different way.
What I would suggest is to take the PK this way and insert it into the SQL statement as a variable.
Dim iUserID as Integer
iUserID = Me.UserID
If Me.Password.Value = DLookup("Password", "Contacts", "[UserID] = " & iUserID) Then
I would also suggest doing the whole thing with variables:
Dim iUserID As Integer
Dim sPass As String
Dim sLook As String
iUserID = Me.UserID
sPass = Me.Password
sLook = DLookup("Password", "Contacts", "[UserID] = " & iUserID)
If sPass = sLook Then...
I can't verify your DLookUp() syntax.
This takes a little more writing but is more manageable. I find a lot of coders have problems pulling values in the middle of processes instead of taking values from the form as variables and then coding with the variable values. It is also easier to troubleshoot, change and adapt when you do it this way.
Did any of that help? What are the values in the variables when you debug?
mmcdonal
|