Simple Mis Match (1 Viewer)

Clayhead22

Registered User.
Local time
Today, 04:53
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.
 

bob fitz

AWF VIP
Local time
Today, 04:53
Joined
May 23, 2011
Messages
4,727
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
 

Minty

AWF VIP
Local time
Today, 04:53
Joined
Jul 26, 2013
Messages
10,371
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.
 

Clayhead22

Registered User.
Local time
Today, 04:53
Joined
Feb 22, 2015
Messages
36
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

Top Bottom