Date expression on forms

A

Alylia

Hello,

I would appreciate if you will help me sorted the error on this date
expression

"If Date >= #7/1/2006# and <= #6/30/2007#" then
txtDate = 2007
End if

I am getting compile error: Expected expression with the <= being highlighted.

thanks
 
J

jmonty

You are missing the Date in the second half. Try:

If Date >= #7/1/2006# and Date <= #6/30/2007#

Also, if Date is the built-in function for the system date function: Date()
then ok...
BUT, if you have a table field or textbox named Date, use brackets: [Date]
FYI: you should not used reserved words such as Date, Time, Now for the
names of table fields or form controls - Access will have trouble
distinguishing what you are trying to do and may give you incorrect results.


jmonty
 
A

Alylia

thx for your prompt response. Appreciated.

jmonty said:
You are missing the Date in the second half. Try:

If Date >= #7/1/2006# and Date <= #6/30/2007#

Also, if Date is the built-in function for the system date function: Date()
then ok...
BUT, if you have a table field or textbox named Date, use brackets: [Date]
FYI: you should not used reserved words such as Date, Time, Now for the
names of table fields or form controls - Access will have trouble
distinguishing what you are trying to do and may give you incorrect results.


jmonty


Alylia said:
Hello,

I would appreciate if you will help me sorted the error on this date
expression

"If Date >= #7/1/2006# and <= #6/30/2007#" then
txtDate = 2007
End if

I am getting compile error: Expected expression with the <= being highlighted.

thanks
 
Top