Date expression on forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top