Results 1 to 3 of 3
  1. #1
    jtmott is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Oct 2013
    Posts
    17

    Query that shows previous workday and Friday-sunday on mondays.

    Hello, I'm new to access and I am trying to write a query that shows the orders that came in on the previous workday but on Mondays it will show the orders that came in on last Friday-Sunday. I'm trying to use the following code and it does work well for Tuesday-Friday but on Monday it does not return anything.


    IIf(DatePart("w",Date())=2,(([Ordercat].[ORDERDATE]) Between DateAdd("d",-3,Date()) And Date()-1),DateAdd("d",-0,Date()))

    I would appreciate any help you can give.

  2. #2
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Code:
    WHERE 
       [Ordercat].[ORDERDATE]
     BETWEEN 
       IIF(Weekday(Date)=2,DateAdd("D",-3,Date),DateAdd("D",-1,Date)) 
    AND 
       DateAdd("D",-1,Date)
    It can all be run together on one line, but I broke it out for legibility.

  3. #3
    jtmott is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Oct 2013
    Posts
    17
    Thank you
    That works great.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. shows previous record on report.....
    By shah1419 in forum Reports
    Replies: 0
    Last Post: 08-28-2013, 02:22 AM
  2. Replies: 9
    Last Post: 04-26-2013, 12:12 PM
  3. Replies: 14
    Last Post: 06-20-2012, 08:54 AM
  4. Replies: 2
    Last Post: 06-11-2012, 07:04 AM
  5. Count Sunday & Saturday between two days.
    By kashif.special2005 in forum Queries
    Replies: 2
    Last Post: 02-23-2012, 06:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums