Results 1 to 3 of 3
  1. #1
    bigchicagobob is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    18

    Simple Date Criteria, Exclude Weekends

    Hello,

    I am attempting to write a query that filters out Orders placed within 2 days of today. Orders can be placed on Monday-Friday, but not placed on Saturday or Sunday. This is a problem for the criteria come Monday because it counts Saturday/Sunday. How can I exclude saturday and sunday from the count?
    Essentially, if an order is on monday, I dont wan't the criteria to count sunday/saturday, but to start on friday.



    Here's what I have written. I've tried using datediff() and weekday() to no avail.


    Order Date: IIf([Order #] Is Null And [qry orders].[order entry date]<Date()-2,"2 days with no order","")




    Thank you,

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    One way:

    Order Date: IIf(IsNull([Order #]) And [order entry date] < Date()-Switch(Weekday([order entry date])=2,4, Weekday([order entry date])=3,5, Null,2),"2 days with no order","")


    Advise no spaces or special characters/punctuation (underscore is exception) in name convention.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    bigchicagobob is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    18
    June,

    Your suggestion helped tremendously. I made a few adjustments to your suggestion because I did not phrase my issue well. Regardless, I now have it working. Thank you.

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

Similar Threads

  1. Yesterday's Date ignoring weekends
    By coletteabrown in forum Access
    Replies: 4
    Last Post: 12-09-2013, 08:02 AM
  2. Replies: 2
    Last Post: 10-03-2013, 02:02 PM
  3. Criteria Needs to Ignore Weekends
    By RichardAnderson in forum Queries
    Replies: 41
    Last Post: 08-30-2013, 08:22 AM
  4. Adding 5 days to date function but exclude weekends
    By mulefeathers in forum Queries
    Replies: 1
    Last Post: 04-27-2012, 10:28 AM
  5. Exclude records within same criteria
    By brooke48 in forum Queries
    Replies: 14
    Last Post: 05-15-2010, 02:15 PM

Tags for this Thread

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