Calculating # of business days

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

I currently have a query that that identifies the number
of calender days between a request for service date and a
scheduled service date. How can i get the query to
calculate the number of business days only? Currently I
am subtracting one date from the other.

Thank you

Mike
 
It's over my head, here is what I found, but how do I
modify it for my application. My fields are named
Received and SchedD

Function Work_Days (BegDate As Variant, EndDate As
Variant) As Integer
' Note that this function does not account for holidays.
Dim WholeWeeks As Variant
Dim DateCnt As Variant
Dim EndDays As Integer

BegDate = DateValue(BegDate)

EndDate = DateValue(EndDate)
WholeWeeks = DateDiff("w", BegDate, EndDate)
DateCnt = DateAdd("ww", WholeWeeks, BegDate)
EndDays = 0
Do While DateCnt < EndDate
If Format(DateCnt, "ddd") <> "Sun" And _
Format(DateCnt, "ddd") <> "Sat" Then
EndDays = EndDays + 1
End If
DateCnt = DateAdd("d", 1, DateCnt)
Loop
Work_Days = WholeWeeks * 5 + EndDays
End Function


Thank you

Mike
 
Back
Top