Hi
I have this module that Mile-O-Phile helped me with and it works great. I have made a couple of changes so that it not only skips over Sundays, but should skip over drivingHolidays. It's doesn't seem to be recognizing driving holidays. stringDriving field should be changing as dteTemp1 changes and it doesn't seem to be changing when it goes through the loop. Can anyone see what my problem with this code?
Thank you in advance for any help!
I have this module that Mile-O-Phile helped me with and it works great. I have made a couple of changes so that it not only skips over Sundays, but should skip over drivingHolidays. It's doesn't seem to be recognizing driving holidays. stringDriving field should be changing as dteTemp1 changes and it doesn't seem to be changing when it goes through the loop. Can anyone see what my problem with this code?
Thank you in advance for any help!
Code:
Public Function NoDrivingHolidays(dteTemp1 As Date, dteTemp2 As Date, strDriving As String, intDays As Integer) As Date
On Error GoTo Err_NoDrivingHolidays
strDriving = "NO"
Do While Not intDays = 0
dteTemp1 = DateAdd("d", -1, dteTemp1)
If (Not WEEKDAY(dteTemp1) = 1) And strDriving = "No" Then
intDays = intDays - 1
End If
Loop
NoDrivingHolidays = dteTemp1
Exit_NoDrivingHolidays:
Exit Function
Err_NoDrivingHolidays:
MsgBox Err.DESCRIPTION, vbExclamation, "Error #" & Err.NUMBER
Resume Exit_NoDrivingHolidays
End Function
Last edited by a moderator: