Date statment

JonyBravo

Registered User.
Local time
Today, 16:19
Joined
Jan 17, 2006
Messages
89
Hi there!

I've got the following code on my database:

strcriteria = "[date] = #txtDay1.value# "

Set rst = dbs.OpenRecordset("tblPlanner", dbOpenDynaset)

rst.FindFirst strcriteria
The problem is when I run the code it have the following error:
Run time error '3077'
"syntax error in date in expression"

I've formated boths date field and txtday1 on short date.
Is there anyone that could tell me what wrong am I doing?

Thanks

Jonybravo
 
JonyBravo said:
Hi there!

I've got the following code on my database:

strcriteria = "[date] = #txtDay1.value# "

Set rst = dbs.OpenRecordset("tblPlanner", dbOpenDynaset)

rst.FindFirst strcriteria
The problem is when I run the code it have the following error:
Run time error '3077'
"syntax error in date in expression"

I've formated boths date field and txtday1 on short date.
Is there anyone that could tell me what wrong am I doing?

Thanks

Jonybravo

Code:
strcriteria = "[date]=#" & txtDay1 & "#"

hth

K

PS date is a reserved word, if you have a field called date you should consider changing it.
 
Thanks Karma, it works perfect.
Could you tell me please in the similar situation but if instead date my table field is Autonumber what code should I use instead of #" & txtnumber &"# ?

Jonybravo
 
JonyBravo said:
Thanks Karma, it works perfect.
Could you tell me please in the similar situation but if instead date my table field is Autonumber what code should I use instead of #" & txtnumber &"# ?

Jonybravo

Numbers don't require anything.
Text fields need '
 

Users who are viewing this thread

Back
Top Bottom