473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Using the dhCountWorkdaysA function

1) dhCountWorkdaysA 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: dhCountWorkdaysA(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!
Nov 13 '05 #1
2 2392
On 5 Oct 2004 11:41:18 -0700, fh**********@yahoo.com (fhuntsman)
wrote:

Before you call this function from your query, first try calling its
simplest form from the Immediate window:
?dhCountWorkdaysA(#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.

1) dhCountWorkdaysA 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: dhCountWorkdaysA(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!


Nov 13 '05 #2
you could always use the code at Arvin Meyer's website...
www.datastrat.com

It's in there somewhere... I've used it- dead simple to use and understand.
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: Daniel | last post by:
Hello =) I have an object which contains a method that should execute every x ms. I can use setInterval inside the object construct like this - self.setInterval('ObjectName.methodName()',...
1
by: Mike | last post by:
When trying to compile (using Visual Web Developer 2005 Express Beta; frameworkv2.0.50215 ) the source code below I get errors (listed below due to the use of ICallBackEventHandler. Ultimately I...
3
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
1
by: Daveyk0 | last post by:
Hello there, I have a front end database that I have recently made very many changes to to allow off-line use. I keep copies of the databases on my hard drive and link to them rather than the...
3
by: Rob | last post by:
Hi all, I am having trouble converting the code below (found on http://vbnet.mvps.org/index.html?code/core/sendmessage.htm) into a format that will work using vb .NET. Can anyone have a look...
14
by: B Williams | last post by:
I am stuck on an assignment that uses classes and functions. I am receiving numerous errors when I try to run a test program to see if I wrote it correctly. Can someone please point me in the right...
2
by: Tugrul HELVACI | last post by:
I'm using Delphi 2006 and I have a class defination like this: TPerson = class fPersonName : String; fPersonSurName : String; fPersonAge : Integer; published property PersonName : String...
2
by: ChrisO | last post by:
I've been pretty infatuated with JSON for some time now since "discovering" it a while back. (It's been there all along in JavaScript, but it was just never "noticed" or used by most until...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.