Results 1 to 2 of 2
  1. #1
    mulefeathers is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Oct 2009
    Posts
    39

    Adding 5 days to date function but exclude weekends

    I have a table named "DATA" this table contains thousands of rows. I am writing a query that will allow a user to look at the data that is 5 days out from the request date in the table plus any older data that is know as past due. I can return this information using <DATE() + 5. This works with no problems except Thursday and Friday. We never have orders due on Saturday or Sunday.

    Is there a way I can tell this function to avoid these two days and only count "business days"?

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    You can use the Weekday() function in your query.

    For instance, I just added this field in Query Design View:
    Code:
    Date_Plus_5: IIf(Weekday([StartDate])=1,DateAdd('d',5,[StartDate]),DateAdd('d',7,[StartDate]))
    What it does is if the StartDate falls on a Sunday [Weekday([StartDate])=1] - then add 5 days [DateAdd('d',5,[StartDate])] otherwise add 7 days [DateAdd('d',7,[StartDate])].

    You'll have to modify this to do what you need.
    If you have not used IIF() before, you can have multiple IIF() functions within the IIF() function to handle various criteria.
    You can also use the IIF logic in the Critera of your query.

    Let us know if you have trouble with it!

    All the bset!!

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

Similar Threads

  1. Replies: 14
    Last Post: 09-11-2013, 01:10 PM
  2. Replies: 8
    Last Post: 09-23-2012, 01:05 AM
  3. Replies: 2
    Last Post: 10-08-2011, 06:33 PM
  4. Replies: 2
    Last Post: 07-31-2009, 06:56 AM
  5. 90 days in the pass - Date help wanted
    By techexpressinc in forum Queries
    Replies: 1
    Last Post: 01-26-2009, 07:13 AM

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