Access days calculation between two date exclude weekeng and holidays

Anonymous
2015-12-01T18:24:25+00:00

Hello, we have the following query statement to calculate the days between two date excluding weekend.

DateValue(Format([Due Date],"mm/dd/yyyy"))-[Order Date]+1-(DateDiff("ww",[Order Date],DateValue(Format([Due Date],"mm/dd/yyyy")),7)-(Weekday([Order Date])=7))-(DateDiff("ww",[Order Date],DateValue(Format([Due Date],"mm/dd/yyyy")),1)-(Weekday([Order Date])=1))

This query statement exclude weekend only.  In addition, that I can add to this statement that I also exclude holidays? Thanks

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Anonymous
    2015-12-02T15:47:28+00:00

    Hello Daniel,

    It would be possible to send me all programming of the query without the comments, so that I may give you copy and paste. Thanks

    0 comments No comments
  2. Anonymous
    2015-12-04T15:02:52+00:00

    It is posible to send me the exact code statement wihtout comment? Thanks

    0 comments No comments
  3. ScottGem 68,775 Reputation points Volunteer Moderator
    2015-12-04T16:39:37+00:00

    Joe,

    You can't do this with a statement. You have to use a User Defined function that you pass values to. The links Daniel gave you are to functions that will work for you. You need to review the code and choose the function that will work best for you. To exclude Holidays you need to have a table of holidays to check against.

    You need to copy the code you choose into a global module, then use the function to return the number of days.

    0 comments No comments