Dlookup multiple criteria with yes/no field

foxy

Registered User.
Local time
Today, 18:51
Joined
Feb 17, 2009
Messages
64
Hi All,

I am trying to implement a user login by using a dlookup against a table called tblUser.

The concept is that if the password entered into the text box matches the password in the table WHERE the username matches the username in the table and the active yes/no field is true then it will let the user in, if not it will throw an error and ask the user to enter again.

My problem is that I am getting a type mismatch within my dlookup. This must be due to the yes/no field I have added into the criteria as it was working before I put this in.

Here's what I have:

Code:
If Me.txtPassword.Value = DLookup("[password]", "[tblUsers]", "[active] = -1 " And "[username]= " & "'" & Me.txtUsername.Value & "'") Then ... etc

Any help would be appreciated.

Thanks,
Foxy
 
Try

Code:
If Me.txtPassword.Value = DLookup("[password]", "[tblUsers]", "[active] = -1 And [username]= " & "'" & Me.txtUsername.Value & "'") Then ... etc

In other words, I've removed the quotes round AND.

hth
Chris
 
Get in! That works.
Thanks very much. Just needed a fresh set of eyes on it.

Cheers,
Foxy
 

Users who are viewing this thread

Back
Top Bottom