Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Nov 2003
    Location
    Belfast, Antrim, Ireland, Northern
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DateDiff (Access 97)

    How do I calculate the number of Working days between two dates in Access 97? The two date field may produce minus as well as plus differences.

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

    Re: DateDiff (Access 97)

    See Calculate Number of Working Days for a simple function. It takes care of weekend days, but not of holidays. You will have to adapt it to work with negative differences.

    See Doing WorkDay Math in VBA for a more complicated series of functions that take holidays into account.

  3. #3
    New Lounger
    Join Date
    Nov 2003
    Location
    Belfast, Antrim, Ireland, Northern
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DateDiff (Access 97)

    How do I Insert this code into a query??

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

    Re: DateDiff (Access 97)

    You must create a new module (in the Modules tab of the database window), and copy the code from one of the links I posted into the module window. Close and save the module; name it basWorkDays, for example.

    You can then use the function(s) in expressions in queries and in the control source of controls on forms and reports. For example, if you use the simpler function Work_Days from the first link, and if you have date fields Date1 and Date2, you can enter this in an empty column in the query design grid:

    Duration: Work_Days([Date1],[Date2])

Posting Permissions

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