Iif function for query

C

clayton ledford

Hello,

In my daily query i'm trying to include values from the prior business day.
So i am using the following criteria for my date field:

IIf(Date()="2",Date()-3,Date()-1)

This works when i run it Tuesday through Friday, but doesn't work when i
need it to... on Monday (for Friday's value). Any ideas?
 
D

Douglas J. Steele

"2" isn't a date.

Assuming you're trying to determine when it's Monday, try

IIf(Weekday()=2,Date()-3,Date()-1)
 
J

John Spencer MVP

How about a minor correction?

IIf(Weekday(Date())=2,Date()-3,Date()-1)

As far as I know, you are required to have an argument for the Weekday function.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 

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

Top