Using the dhCountWorkdaysA function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • fhuntsman

    Using the dhCountWorkdaysA function

    1) dhCountWorkdays A comes from "Visual Basic Language Developer's
    Handbook"
    by Ken Getz and Mike Gilbert

    2) I place this function and the other functions that are needed for
    this to work in modules.

    3) The argument it calls: dhCountWorkdays A(ByVal dtmStart As Date,
    ByVal _ dtmEnd As Date, Optional adtmDates As Variant = Empty) As
    Integer
    *shows the first two variables as dates.

    4) In a query, I call this function to create a calculated field
    from the two date fields that are placed in the argument. The two
    fields that I am assigning those two variables are indeed date types.
    The third varible can take serial dates (e.g. #11/25/2004#)

    5. The query saves (no syntax errors) but when I try to run it, it
    gives the "Data type mismatch in criteria expression." - under Help,
    this says that the field data type does not match what is being
    called.

    6. Here is my dilemma: I have tripled checked that the field data
    type is in fact data types to match *dtmStart As Date and dtmEnd As
    Date* ---I cannot think of any other ways that the data is being
    mismatched.

    IF anyone has used this formula, please let me know exactly how to use
    this formula to calculate a new field.

    I'm stumped!
    Thanks!
  • Tom van Stiphout

    #2
    Re: Using the dhCountWorkdays A function

    On 5 Oct 2004 11:41:18 -0700, fhuntsman_00@ya hoo.com (fhuntsman)
    wrote:

    Before you call this function from your query, first try calling its
    simplest form from the Immediate window:
    ?dhCountWorkday sA(#1/1/2004#, #2/2/2004#)

    Perhaps you'll find that this doesn't work either, and you can step
    through the code in the debugger to find out what's going on.

    Chances are the above works. Then I would suspect your data: perhaps
    sometimes a Null value is passed in as an argument: Dates cannot be
    Null, only Variants can. Also, dates have to fall within some range.
    A date way back, or far in the future can be a typo, but may not pass
    as a valid date. Again, the debugger is a wonderful tool; just hit
    Ctrl+Break when you get the error and you may learn what's wrong.

    -Tom.

    [color=blue]
    >1) dhCountWorkdays A comes from "Visual Basic Language Developer's
    >Handbook"
    > by Ken Getz and Mike Gilbert
    >
    >2) I place this function and the other functions that are needed for
    >this to work in modules.
    >
    >3) The argument it calls: dhCountWorkdays A(ByVal dtmStart As Date,
    >ByVal _ dtmEnd As Date, Optional adtmDates As Variant = Empty) As
    >Integer
    > *shows the first two variables as dates.
    >
    >4) In a query, I call this function to create a calculated field
    >from the two date fields that are placed in the argument. The two
    >fields that I am assigning those two variables are indeed date types.
    >The third varible can take serial dates (e.g. #11/25/2004#)
    >
    >5. The query saves (no syntax errors) but when I try to run it, it
    >gives the "Data type mismatch in criteria expression." - under Help,
    >this says that the field data type does not match what is being
    >called.
    >
    >6. Here is my dilemma: I have tripled checked that the field data
    >type is in fact data types to match *dtmStart As Date and dtmEnd As
    >Date* ---I cannot think of any other ways that the data is being
    >mismatched.
    >
    >IF anyone has used this formula, please let me know exactly how to use
    >this formula to calculate a new field.
    >
    >I'm stumped!
    >Thanks![/color]

    Comment

    • Pieter Linden

      #3
      Re: Using the dhCountWorkdays A function

      you could always use the code at Arvin Meyer's website...
      Database Consulting, Business Computer Solutions in Orlando, FL MCP, MVP, Networking, Computers, consulting


      It's in there somewhere... I've used it- dead simple to use and understand.

      Comment

      Working...