counting only weekdays not weekends

  • Thread starter Thread starter Joyce
  • Start date Start date
J

Joyce

I have a report that shows the percent that an established
goal was reached concerning turnaround time on various
file types. The turn around time is 2, 5 or 10 days. I
was given this code to count business days and omit
weekends.

I don't know what the "w" is in the code, can someone
explain that and also this code assumes all turnaround
days are 2, but it can be 2, 5 or 10. How would I list
the turnaround days for each case type. My field name is
CaseTypeID = 1 with a turnaround assigned as 2
CastTypeID = 2 with a turnaround assigned as 5
CaseTypeID = 3 with a turnaround assigned as 10

I appricitae your help, thanks

Private Sub Detail_Format(Cancel As Integer, FormatCount
As Integer)

Dim intAddedDays As Integer
Select Case DatePart("w", DateReceived)
Case vbMonday to vbWednesday
intAddedDays = 0
Case Else
intAddedDays = 2
End Select
DaysForCase = 2 + intAddedDays

End Sub
 
The "w" means the datepart to be returned is the Day of the Week (1-7).

Private Sub Detail_Format(Cancel As Integer, FormatCount
As Integer)

Dim intAddedDays As Integer
Select Case Me.CaseTypeID
Case 1
Select Case DatePart("w", DateReceived)
Case vbMonday to vbWednesday
intAddedDays = 0
Case Else
intAddedDays = 2
End Select
Case 2
IntAddedDays = 5
Case 3
IntAddedDays = 12
End Select

DaysForCase = 2 + intAddedDays

End Sub
 
Back
Top