[AccessD] difference in days

Pedro Janssen pedro at plex.nl
Fri Oct 20 11:50:22 CDT 2006


I tried the code from Paul first, but get an error: "You used an inaccurate 
number of arguments in a function"
The same error with the code from Gustav.

What am i doing wrong. in my table there are two date fields: FromDate = 
[DatOnt], ToDate = [datScr].

So this is the function that i then use:



Public Function HowManyWD(DatOnt As Date, _
DatScr As Date, _
Optional ToDateIsIncluded As Boolean = True)

HowManyWD = DateDiff("d", DatOnt, DatScr) - _
ToDateIsIncluded - _
HowManyWD(DatOnt, DatScr, vbSunday) - _
HowManyWD(DatOnt, DatScr, vbSaturday)
End Function


What is going wrong


Pedro Janssen





----- Original Message ----- 
From: <paul.hartland at fsmail.net>
To: "Access Developers discussion and problem solving" 
<accessd at databaseadvisors.com>
Sent: Friday, October 20, 2006 1:42 PM
Subject: Re: [AccessD] difference in days


> Pedro,
>
> I think you would have to use the function (or similar) that you can get 
> from the Access Web, see below:
>
> '************* Code Start *************
> Public Function HowManyWeekDay(FromDate As Date, _
>                            ToDate As Date, _
>                            Optional ToDateIsIncluded As Boolean = True)
>
>    HowManyWeekDay = DateDiff("d", FromDate, ToDate) - _
>                    ToDateIsIncluded - _
>                    HowManyWD(FromDate, ToDate, vbSunday) - _
>                    HowManyWD(FromDate, ToDate, vbSaturday)
> End Function
> '************* Code End *************
>
> Paul Hartland
>
>
>
>
>
> Message Received: Oct 20 2006, 12:14 PM
> From: pedro at plex.nl
> To: accessd at databaseadvisors.com
> Cc:
> Subject: [AccessD] difference in days
>
> Hallo Group,
>
> i used the following sql to calculate the difference between two dates.
>
> SELECT Datum.Rapnaam, DateDiff("d",[DatOnt],[DatScr]) AS verschil
> FROM Datum;
>
> but i forgot that i only need the difference in workingdays, without the 
> weekends.
>
> Is there a way to adjust the sql?
>
> Pedro Janssen
>
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>
>
>
>
> Paul Hartland
> paul.hartland at fsmail.net
> 07730 523179
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 




More information about the AccessD mailing list