Reputation: 17
Please help. I am trying to validate the username and password from another table. The below code gives me "Type mismatch error". I have no idea why. Please help.
If (DLookup("[UserLogin]", "Sheet1", _
"[UserLogin] ='" & Me.txtloginid.Value & "' And [Password] = '" & Me.txtpassword.Value & "'")) Then
Upvotes: 0
Views: 44
Reputation: 55921
This will happen if UserLogin is numeric.
Also, don't rely on Null values for logic operations:
If Not IsNull(DLookup("[UserLogin]", "Sheet1", _
"[UserLogin] = " & Me.txtloginid.Value & " And [Password] = '" & Me.txtpassword.Value & "'")) Then
Upvotes: 1