Change the data type of the second parameter to Variant (this will allow it
to be null). Then, check to see if it is NULL and if so, convert it to
todays date You could even make the second parameter optional so if you only
pass it one date, it will automatically use todays date as the dtmEnd.
HTH
Dale
Function CalcWorkDays(dtmStart As Date, _
Optional dtmEnd As Variant = NULL) As
Integer
Dim intTotalDays As Integer ' Counter for number of days
Dim dtmToday As Date ' To increment the date to compare
'Compliments of Dave Hargis
'Added this line
if ISNULL(dtmEnd) then dtmEnd = Date()
intTotalDays = DateDiff("d", dtmStart, dtmEnd) +1 'Start with total days
'Add one to include First Day
> dtmToday = dtmStart 'Initiate compare date
> Do Until dtmToday > dtmEnd
[quoted text clipped - 13 lines]
> CalcWorkDays = intTotalDays 'Return the value
> End Function

Signature
Email address is not valid.
Please reply to newsgroup only.
> I am using the following code to calculate buisness days which is working
> fine, but it requires input of both start and end dates.
[quoted text clipped - 31 lines]
>
> Thank You.
Pierre - 22 May 2007 12:38 GMT
That modification is just what I needed, it is working well.
Thank you very much.
> Change the data type of the second parameter to Variant (this will allow it
> to be null). Then, check to see if it is NULL and if so, convert it to
[quoted text clipped - 71 lines]
> >
> > Thank You.