Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

working days formula

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Working days formula

Working days formula

ResolvedVersion 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?

Edited on Mon 26 Oct 2009, 15:26

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 courses

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
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Access tip:

Switchboard Startup

An option when you open your Access database that contains all of you tables, forms and queries is only the switchboard is displayed.

To achieve this, select Tools click on Startup. On the right hand side of the Startup screen you are able to select which form you want to open when you open you Access Database. Once you have selected this, there is a check box just below that says "Display Database Window", you need to uncheck this option. Then click ok.

Then when you close you Access database and re open it, the database should open with just the switchboard being shown


View all Access hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.12 secs.