Dgavilanes
Registered User.
- Local time
- Today, 15:32
- Joined
- Jun 25, 2001
- Messages
- 109
Hi all,
I have two dates, start date and enddate in a form, would like to calculate working dates between both dates in a third field called Exp:
(using a query buider in the form)
<code>
Public Function GetNumberOfWorkDays(sStartDate, sEndDate)
Dim iDays
Dim iWorkDays
Dim sDay
Dim i
iDays = DateDiff("d", sStartDate, sEndDate)
iWorkDays = 0
For i = 0 To iDays
'First day of the week is sunday
sDay = Weekday(DateAdd("d", i, sStartDate))
If sDay <> 1 And sDay <> 7 Then
iWorkDays = iWorkDays + 1
End If
Next
GetNumberOfWorkDays = iWorkDays
End Function
I never done this before
How do I get this in place and make it work
please advice
Dennis
I have two dates, start date and enddate in a form, would like to calculate working dates between both dates in a third field called Exp:
(using a query buider in the form)
<code>
Public Function GetNumberOfWorkDays(sStartDate, sEndDate)
Dim iDays
Dim iWorkDays
Dim sDay
Dim i
iDays = DateDiff("d", sStartDate, sEndDate)
iWorkDays = 0
For i = 0 To iDays
'First day of the week is sunday
sDay = Weekday(DateAdd("d", i, sStartDate))
If sDay <> 1 And sDay <> 7 Then
iWorkDays = iWorkDays + 1
End If
Next
GetNumberOfWorkDays = iWorkDays
End Function
I never done this before
How do I get this in place and make it work
please advice
Dennis