count days

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DeanO
    New Member
    • Feb 2007
    • 28

    count days

    I want to count the number of days reference a shipping order. I need to exclude weekends and holidays. Thank you.
  • Scott Price
    Recognized Expert Top Contributor
    • Jul 2007
    • 1384

    #2
    Originally posted by DeanO
    I want to count the number of days reference a shipping order. I need to exclude weekends and holidays. Thank you.
    Hello Dean,

    This thread: Calculate end date (working day) in Access has a function written to count week days (excluding week-ends).

    Excluding holidays will be a little more difficult, since these change depending on country, region, etc. As far as I know, Access/VBA does not have a list of holidays built-in so you will likely have to create one that applies to your corner of the world.

    To do this, you'll create a table, call it tblHolidays, give it a primary key of HolidayID Autonumber, second field is HolidayDate, third is HolidayName.

    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.

    We'll be happy to help on any parts of this you don't understand, or get stuck on, but we'll wait until you make a start since we can't do the work for you :-)

    Regards,
    Scott
    Last edited by NeoPa; Jul 6 '10, 11:43 AM. Reason: Update link

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32645

      #3
      A new thread (Count Working Days) has been created from a hijack post added in here.

      Comment

      Working...