98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Access VBA Training and help » Working days formula
Working days formula
Resolved · High Priority · Version 2003
James has attended:
Access VBA course
Working days formula
calculating working days diff rather than daysdiff.
steve asked to post reminder
RE: working days formula
Hi James
Thanks for the post, Stephen is available tomorrow and will review your post.
regards
Jacob
RE: working days formula
Still no reply to my question
Unless I am missing it?
RE: working days formula
Hi James
Apologies, I was sure I had answered this but I can find no reference to it, so I can only imagine that there was some glitch when I tried to post.
The following function will count the working days between two dates, by excluding Saturdays and Sundays.
Function WorkDays(dteStart As Date, dteFinish As Date) As Integer
Dim dteDateCount As Date
Dim intCount As Integer
For dteDateCount = dteStart To dteFinish
If Weekday(dteDateCount) <> 7 Then 'excludes saturdays
If Weekday(dteDateCount) <> 1 Then 'excludes sundays
intCount = intCount + 1
End If
End If
Next dteDateCount
WorkDays = intCount
End Function
It uses the vb function weekdays to exclude dates on a saturday (day7) or a sunday(day1).
The following procedure calls this function and places two dates for the start and finish arguments
Sub Caller()
MsgBox WorkDays(#10/19/2009#, #10/28/2009#)
End sub
Hope this helps
Regards
Stephen
Mon 2 Nov 2009: Automatically marked as resolved.
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Access tip:Duplicating an EntryTo duplicate the entry press CTRL+' (apostrophe)this will copy the contents of the previous entry in the same field. |