Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Macro Condition 2

Status
Not open for further replies.

Mike555

Technical User
Feb 21, 2003
1,200
US
I have an autoexec macro that opens 2 reports automatically when the db is opened. I'm trying to setup a 3rd report to open automatically, but it should open only if the date is between 12/31 - 01/31. The expression I've created below doesn't work.

Now() >= 12/31 and <= 01/31

Thanks.
 
do you mean only if the month is january?
of any year? or just this year?
it's reading your '12/31' and '01/31' as text. you have to put # around a date so it reads it as a date:

if you just want it to be january of any year:

Code:
Month(Date()) = 1

otherwise use this type of format:

Code:
Date() between #1/1/03# and #12/31/03#

or if you mean &quot;in between 12/31 of last year and 1/31 of this year&quot; then use this:
Code:
Date() between cdate(&quot;12/31/&quot;&year(Date())-1) and cdate(&quot;1/31/&quot;&year(Date()))
 
Month(Date()) = 1 is what I needed. Thanks!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top