Add only working days

aingram

Registered User.
Local time
Today, 21:04
Joined
Jun 20, 2005
Messages
29
Help please, im using this code
Code:
Private Sub Target_Combo_AfterUpdate()
    Select Case Target_Combo
    Case "Emergency"
        Me.TARGET_COMPLETION_DATE = Me.ISSUE_DATE
    Case "3 Days"
        Me.TARGET_COMPLETION_DATE = DateAdd("d", 3, Me.ISSUE_DATE)
    Case "3 Weeks"
        Me.TARGET_COMPLETION_DATE = DateAdd("d", 21, Me.ISSUE_DATE)
    Case "28 Days"
        Me.TARGET_COMPLETION_DATE = DateAdd("d", 28, Me.ISSUE_DATE)
    Case "2 Months"
        Me.TARGET_COMPLETION_DATE = DateAdd("m", 2, Me.ISSUE_DATE)
    Case "4 Months"
        Me.TARGET_COMPLETION_DATE = DateAdd("m", 4, Me.ISSUE_DATE)
    Case "6 Months"
        Me.TARGET_COMPLETION_DATE = DateAdd("m", 6, Me.ISSUE_DATE)
End Select
End Sub

But i want it to add only working days (monday to friday) so if i added 3 working days on to fridays date then the date would be for wednesday
 
Last edited:
Do a search, this crops up almost weekly

Col
 
Here's one I use:
Code:
Public Function PlusWorkdays(dteStart As Date, intNumDays As Long) As Date

PlusWorkdays = dteStart
Do While intNumDays > 0
     PlusWorkdays = DateAdd("d", 1, PlusWorkdays)
     If Weekday(PlusWorkdays, vbMonday) <= 5 Then
'-- If you have a Holiday Table use the next IF instead!
'     If Weekday(PlusWorkdays, vbMonday) <= 5 And _
      IsNull(DLookup("[Holiday]", "tblHolidays", _
      "[HolDate] = #" & PlusWorkdays & "#")) Then
          intNumDays = intNumDays - 1
     End If
Loop
End Function
I have it in a standard module.
 

Users who are viewing this thread

Back
Top Bottom