OK guys and gals, I have a piece of code for Access that calculates the number of work days between 2 given dates. However, this code does not take into account any Holidays that may exist. Can someone please show me how to modify or write new code that can calculate the number of workdays between 2 dates and take into account a list of holidays from say a "Holiday Table"?
The code I have is this:
**************************
Public Function CountWeekDays(SLADate As Date, DevDate As Date) As Integer
' count the number of week days between two dates
Dim CheckDate As Date
CountWeekDays = 0
CheckDate = SLADate
Do Until CheckDate > DevDate
If WeekDay(CheckDate) <> 1 And WeekDay(CheckDate) <> 7 Then
CountWeekDays = CountWeekDays + 1
End If
CheckDate = CheckDate + 1
Loop
End Function
***************************
Any help you can give will be greatly appreciated!!! Thanks!
The code I have is this:
**************************
Public Function CountWeekDays(SLADate As Date, DevDate As Date) As Integer
' count the number of week days between two dates
Dim CheckDate As Date
CountWeekDays = 0
CheckDate = SLADate
Do Until CheckDate > DevDate
If WeekDay(CheckDate) <> 1 And WeekDay(CheckDate) <> 7 Then
CountWeekDays = CountWeekDays + 1
End If
CheckDate = CheckDate + 1
Loop
End Function
***************************
Any help you can give will be greatly appreciated!!! Thanks!