Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Apr 2003
    Location
    Jacksonville, North Carolina, USA
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calculate DateDiff between 'business' days (2003)

    I did do a search on the site for any prior resolutions to calculating the datediff between two "business" days, excluding weekends and holidays. However, what I found looked overwhelming to me. Can anyone simplify and/or offer further explanations of the codes found to help me grasp and tailor for my use?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calculate DateDiff between 'business' days (2003)

    I have attached a zipped sample database with just 2 objects: a table tblHolidays (with some sample holidays) and a module basWorkdays with 2 functions:
    WorkingDays calculates the number of working days between two dates.
    AddWorkDays adds the specified number of working days to a date.
    You can import the table and module into your database (File | Get External Data | Import) and use the functions for your own purposes.

    Note: you need a reference to the Microsoft DAO 3.6 Object Library in Tools | References in the Visual Basic Editor.
    Attached Files Attached Files

  3. #3
    2 Star Lounger
    Join Date
    Apr 2003
    Location
    Jacksonville, North Carolina, USA
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calculate DateDiff between 'business' days (2003)

    Will this same coding work in Crystal Report?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calculate DateDiff between 'business' days (2003)

    Instead of

    Set dbs = CurrentDb

    you'd have to use a line like

    Set dbs = DBEngine.OpenDatabase("CatabasesMyDatabase.mdb")

    where CatabasesMyDatabase.mdb is the database containing the tblHolidays table, and you'd have to add a line

    dbs.Close

    above the line

    Set dbs = Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •