Date field syntax for Dlookup

sohailcdc

Registered User.
Local time
Today, 05:27
Joined
Sep 25, 2012
Messages
55
Hello

New to this world, just trying to learning during my free time specially during the weekend

I have table [table1] which have 4 fields
EMPID - primary key
EMPFirstname
EMPLastname
EMPDOB

Input box as txtempid as string

I am trying to learn how I to display other field based on one field in my case last three field based on EMPID
I am actually getting syntax error when I dry to display DATE Field

Following are my attempts

Dim Verfirstname as string
Dim Verlastname as string
Dim VerDOB as date

Verfirstname = dlookup("[EMPfirstname]","table1","[EMPID]='" & me.txtempid & "'")
Msgbox Verfirstname
works fine

But when I use for Date
I am getting syntax error

VerDOB = dlookup("[EMPDOB]","table1","[EMPID]='" & me.txtempid & "'")
Msgbox VerDOB ---- now I am getting syntax error
I tried to understand over net and I believe i need to used with "#" before and after the date field but my criteria

Any suggestion will be appreciate
 
thanks to all, it's my fault wrongly missing ' in the last "'" wrongly typed ""
 

Users who are viewing this thread

Back
Top Bottom