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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Day and Time 1

Status
Not open for further replies.
Feb 25, 2008
46
US
I am running a select query on a table where the date range is 3 days if the current day is Monday and date range is 1 day if the current day is any day other than Monday
The purpose of this query is to view records added on the previous day. On Monday, it views the records added on Friday, Saturday and Sunday.
I need to do this as this is a repetitive daily task.

I am using this syntax:
Between IIf(Weekday(Date())=2,Date()-3,Date()-1) And Date()-1

The query runs fine.

But sometimes it leaves out records which are captured when I use - Between #MM/DD/YYYY# And #MM/DD/YYYY 11:59:59 PM#.

Could someone please suggest a way to incorporate the time component in the above syntax (Between IIf(Weekday(Date())=2,Date()-3,Date()-1) And Date()-1)?

Thanks in Advance!
 
What about this ?
>=IIf(Weekday(Date())=2,Date()-3,Date()-1) AND <Date()

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top