Results 1 to 11 of 11
  1. #1
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Working days (2003)

    I have a report which tells me the dates that test bars went for analysis. I want to add a text field to the report, which displays 2 'working days' from the Issue date, but can't seem to find what to do.

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

    Re: Working days (2003)

    Date/Time: Doing WorkDay Math in VBA on the Access Web contains a series of VBA functions that you can use.

  3. #3
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Working days (2003)

    Thanks for that Hans.

  4. #4
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Working days (2003)

    Looks like I'm going to have populate the control using a module, but I don't know how to call it.

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

    Re: Working days (2003)

    You should copy the code from the web page I referred to into a standard module (the type that you create by selecting Insert | Module in the Visual Basic Editor). You can then use the functions in expressions, for example you can set the Control Source of the relevant text box to

    =dhAddWorkDaysA(2, [IssueDate])

    where IssueDate is the name of the field you want to add 2 working days to.

  6. #6
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Working days (2003)

    Copied the code, and put a text box on the report, to call the module. Named the module dhAddWorkDaysA. When I run the report, a parameter box asks me for dhAddWorkDaysA.

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

    Re: Working days (2003)

    dhAddWorkdays is the name of one of the functions in the module. You should never give a module the same name as a function, that causes confusion. Give the module a different name, for example modWorkdays.

  8. #8
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Working days (2003)

    Give another name to the module. Any name, but not the name of the function.
    Francois

  9. #9
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Working days (2003)

    I'm getting a complie error at dhNextWorkdayA

  10. #10
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Working days (2003)

    You have to copy all the functions from Date/Time: Doing WorkDay Math in VBA to the module, because they are calling each other.
    Francois

  11. #11
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Working days (2003)

    Sorted now. Thanks all.

Posting Permissions

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