Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Mar 2003
    Location
    Mississauga, ON
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Count Business Day (Access 2000)

    I am trying to use the function provided in Accarch 96 countbusinessdays. I keep getting an error message. I am using Access 2000 in Canada if that means anything re dates.

    When I get the error message I select debug and it takes me to this line "dteTemp = dteTemp +1" when I point my mouse pointer over it this is displayed "dteTemp = 9999/12/31 10:14:29 AM"

    dteTemp is defined in the DIM statement as a Date.

    I am a beginner so I am just learning this stuff now, but I am at my wits end as to how to fix.

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Count Business Day (Access 2000)

    There have been a number of threads and pointers to Microsoft Knowledge Base articles on how to count business or work days. You can do a search on work days and find several recent (last few days) threads. BTW, what is Accarch 96 <img src=/S/question.gif border=0 alt=question width=15 height=15>
    Wendell

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

    Re: Count Business Day (Access 2000)

    AccArchnn.zip is a download from Helen Feddema's Access Archon.

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

    Re: Count Business Day (Access 2000)

    You can see that dteTemp has a time part as well as a date part. TheCountBusinessDays function as written expects pure date values as input. The part

    dteTemp = dteStart
    Do Until dteTemp = dteEnd + 1
    ...
    dteTemp = dteTemp + 1
    Loop

    will go into an endless loop if dteStart has a time fraction and dteEnd hasn't, and cause an overflow when dteTemp passes 12/31/9999.

    You must either ensure that dteStart and dteEnd are pure dates, without a time fraction (for instance, use Date() instead of Now() to get the current date), or modify the Do Until line to

    Do Until dteTemp >= dteStart

    (Note: this instruction contains a "greater than" immediately followed by "equals" - meaning "greater than or equal to". Some browsers display some kind of html code instead)

Posting Permissions

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