Iif function for query

  • Thread starter Thread starter clayton ledford
  • Start date Start date
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?
 
"2" isn't a date.

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

IIf(Weekday()=2,Date()-3,Date()-1)
 
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
 
Back
Top