I've fallen foul of the error in the DateDiff function (MS Access 2002) when trying to find the number of working days between two dates. I've had no end of problems working round the issue, but the last problem has stumped me.
I've implemented the MS provided workaround as detailed here:
http://support.microsoft.com/kb/288194
Essentially, this means using a UDF called DateDiffW instead of the documented DateDiff function (i.e. DateDiff("w",startdate,enddate)).
If I put the following code in the intermediate window;
?DateDiffW(#05/11/2012#,#11/11/2012#)
I get an answer of 130, when I expected an answer of 4. If I call the function from a query (inputting the same dates). I get a "Type missmatch" error.
This 130 answer suggests to me that the function is getting confused with date formats (I'm entering UK date format, not American date format). I've tried pre-formatting the date in the function (i.e. DateDiffW(format(#05/11/2012#,"mm/dd/yyyy"),format(#11/11/2012#"mm/dd/yyyy"))), but to no avail.
Suggestions?
Stuart
I've implemented the MS provided workaround as detailed here:
http://support.microsoft.com/kb/288194
Essentially, this means using a UDF called DateDiffW instead of the documented DateDiff function (i.e. DateDiff("w",startdate,enddate)).
If I put the following code in the intermediate window;
?DateDiffW(#05/11/2012#,#11/11/2012#)
I get an answer of 130, when I expected an answer of 4. If I call the function from a query (inputting the same dates). I get a "Type missmatch" error.
This 130 answer suggests to me that the function is getting confused with date formats (I'm entering UK date format, not American date format). I've tried pre-formatting the date in the function (i.e. DateDiffW(format(#05/11/2012#,"mm/dd/yyyy"),format(#11/11/2012#"mm/dd/yyyy"))), but to no avail.
Suggestions?
Stuart