Simple Mis Match

Clayhead22

Registered User.
Local time
Today, 01:33
Joined
Feb 22, 2015
Messages
36
I have created a Lookup function and i have used this exact layout before and it has worked however this time i get a data mis-match. Can anybody see where i have gone wrong?

Code:
If (IsNull(DLookup("[Username]", "Users", "[Username] ='" & Me.Username.Value & "' And [Date of Birth] = '" & Me.Date_Of_Birth.Value & "' And [Email] = '" & Me.Email.Value & "' And [Mobile] = '" & Me.Mobile.Value & "' And [Postal Code] = '" & Me.Post_Code.Value & "'"))) Then
MsgBox "Incorrect Details Entered"
Else

I am hoping its something simple i have missed although can not spot.
 
Perhaps:
Code:
If (IsNull(DLookup("[Username]", "Users", "[Username] ='" & Me.Username.Value & "' And [Date of Birth] = [COLOR="Navy"]#[/COLOR]" & Me.Date_Of_Birth.Value & "[COLOR="navy"]# [/COLOR]And [Email] = '" & Me.Email.Value & "' And [Mobile] = '" & Me.Mobile.Value & "' And [Postal Code] = '" & Me.Post_Code.Value & "'"))) Then
MsgBox "Incorrect Details Entered"
Else
 
Assuming Your Date of birth field is actually a date you will need to surround it with # not '
Code:
If (IsNull(DLookup("[Username]", "Users", "[Username] ='" & Me.Username.Value & "' And [Date of Birth] = [COLOR="Red"]#" & Me.Date_Of_Birth & "# [/COLOR]And [Email] = '" & Me.Email.Value & "' And [Mobile] = '" & Me.Mobile.Value & "' And [Postal Code] = '" & Me.Post_Code.Value & "'"))) Then ...

Also you don't need to add .Value to the end of every control. Value is the default property and will save you lots of typing and make thins easier to read.
 
Ahhh how stupid of my lol After staring at it for an hour i still didn't notice it.

Thanks again.
 

Users who are viewing this thread

Back
Top Bottom