Count Working Days

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jerry Maiapu
    Contributor
    • Feb 2010
    • 259

    Count Working Days

    Hi Scott Prince, Since this dean is not interested I need to do the same as Dean is trying to do. Since Dean has not replied would you mind to show me how to do this:
    You'll have to open this into a recordset programatically and loop through comparing each date with the fixed holiday date to get your day count minus holidays. Then you can run the result through the weekday count function to return a final number of working days.

    I already created a table tblHolidays with fields HolidayID,Holid ayDate and HolidayName and enetred all the public holidays in my country.

    Thankyou

    Jerry

    ** Admin Edit **
    This was moved here from, and is related to, count days.
    Last edited by NeoPa; Jul 6 '10, 11:47 AM. Reason: Added link to related thread
  • colintis
    Contributor
    • Mar 2010
    • 255

    #2
    Originally posted by Jerry Maiapu
    Hi Scott Prince, Since this dean is not interested I need to do the same as Dean is trying to do. Since Dean has not replied would you mind to show me how to do this:
    You'll have to open this into a recordset programatically and loop through comparing each date with the fixed holiday date to get your day count minus holidays. Then you can run the result through the weekday count function to return a final number of working days.

    I already created a table tblHolidays with fields HolidayID,Holid ayDate and HolidayName and enetred all the public holidays in my country.

    Thankyou

    Jerry
    If you make a table to store the holidays in your country then it would be more simple.

    First you will need a query to count number of public holidays occurred in week-days between the date range. Then you do the minus to the number of working days with this count.

    In Scott Prince's method, you go through the loop, use the starting date to compare the recordset with month and day. If the month and day are >= the start date, then a -1 to the number of working days, repeat until the ending date. If it will cross to the other year such as 2009 to 2010, then you might need to find a way to count in 2 separate parts (1 for 2009 and 1 for 2010). I'm not sure if there's a better idea to handle the year issue as this is how I did to some similar situation.

    Comment

    • FishVal
      Recognized Expert Specialist
      • Jun 2007
      • 2656

      #3
      My 5c .

      Comment

      • Jerry Maiapu
        Contributor
        • Feb 2010
        • 259

        #4
        FishVal's solution worked. Thanks.

        Comment

        Working...