I copied this code from the forum. There's a problem on this line: dtmTemp = DateAdd("d", 1, dtmTemp)
what's wrong with it. Tks
Public Function NextWorkDay(dtmDate As Date) As Date
'****************************************
'Created By: Robert L. Johnson III
'Mod Date: February 19, 2003
'Purpose: Determine the next business (working) day
'In: dteDate is the date to be checked
'Out: Returns the next business day
'Example: NextWorkDay(#12/31/02#) returns 1/2/03
' (1/1/01 is a holiday (New Year's Day))
'****************************************
Dim dtmTemp As Date
Dim blnNextWorkday As Boolean
dtmTemp = dtmDate + 1
blnNextWorkday = False
Do Until blnNextWorkday = True
If IsWeekend(dtmTemp) = True Or IsHoliday(dtmTemp) = True Then
dtmTemp = DateAdd("d", 1, dtmTemp)
Else
blnNextWorkday = True
End If
Loop
NextWorkDay = dtmTemp
End Function
what's wrong with it. Tks
Public Function NextWorkDay(dtmDate As Date) As Date
'****************************************
'Created By: Robert L. Johnson III
'Mod Date: February 19, 2003
'Purpose: Determine the next business (working) day
'In: dteDate is the date to be checked
'Out: Returns the next business day
'Example: NextWorkDay(#12/31/02#) returns 1/2/03
' (1/1/01 is a holiday (New Year's Day))
'****************************************
Dim dtmTemp As Date
Dim blnNextWorkday As Boolean
dtmTemp = dtmDate + 1
blnNextWorkday = False
Do Until blnNextWorkday = True
If IsWeekend(dtmTemp) = True Or IsHoliday(dtmTemp) = True Then
dtmTemp = DateAdd("d", 1, dtmTemp)
Else
blnNextWorkday = True
End If
Loop
NextWorkDay = dtmTemp
End Function