Dreamweaver
Well-known member
- Local time
- Today, 22:43
- Joined
- Nov 28, 2005
- Messages
- 2,466
Working Days Is A Sting of days monday - friday in this case in the format of "2,3,4,5,6," as is in My employee example
The code below loops testing the string until it returns 0 I.E. day not found
It moves the "EndDate" to the last available working day in that week I.E Friday
The code below works but had to play with it to get it working and I feel It is very messy could anybody help me clean it up
The code below loops testing the string until it returns 0 I.E. day not found
It moves the "EndDate" to the last available working day in that week I.E Friday
The code below works but had to play with it to get it working and I feel It is very messy could anybody help me clean it up
Code:
Private Sub StartDate_AfterUpdate()
Dim I As Integer, O As Integer
Dim F As Integer
Me.Dirty = False
F = 1
O = Weekday(StartDate) + 1
I = Weekday(StartDate)
Do While F <> 0
I = I + 1
F = InStr(Me![WorkingDays], I)
'Debug.Print F, I, Me![WorkingDays], O
Loop
I = I - O
Me![EndDate] = DateAdd("d", I, Me![StartDate])
End Sub