I'm using an unbound field that provides me with the maximum allowable work hours for employees. I have the following module that seems to work for an employee with a compressed work schedule having weekends and Mondays off. I have a table that contains a list of holidays and they're also excluded. I have figured out up until this point. However, if a holiday falls in his day off (Mondays) that employee has Monday and the next day off. Any suggestions on how id calculate that in here I was thinking with another criteria where if datestoexclude = 2 then incount - 2. not sure how to incorporate it though
Public Function Workingcompressed(StartDate As Date, EndDate As Date) As Integer
On Error GoTo Err_Workingcompressed
Dim intCount As Integer
Dim temp As Integer
Dim strWhere As String
If StartDate = EndDate Then
Workingcompressed = 1
Exit Function
End If
intCount = 1
Do Until StartDate = EndDate
Select Case Weekday(StartDate)
Case Is = 1, 7, 2
intCount = intCount
Case Else
intCount = intCount + 1
End Select
strWhere = "datetoexclude=#" & StartDate & "#"
If DCount("datetoexclude", "datestoexclude", strWhere) > 0 Then
intCount = intCount - 1
End If
StartDate = StartDate + 1
Loop
Workingcompressed = intCount
exit_workingcompressed:
Exit Function
Err_Workingcompressed:
MsgBox Err.Description
Resume exit_workingcompressed
End Function