Joe Rojas
JRojas at tnco-inc.com
Wed Mar 31 11:56:55 CST 2004
Don't know if it is the most efficient or even if I wrote it. :)
Public Function CalcWorkDays(Start As Date, Optional Finish As Date) As
Integer
Dim NumOfDays As Long
Dim NumOfWorkDays As Integer
Dim DayNum As Integer
If Finish = #12:00:00 AM# Then Finish = Date
NumOfDays = DateDiff("d", Start, Finish)
NumOfWorkDays = 0
For i = 1 To NumOfDays
DayNum = Weekday(Start + i)
If (DayNum <> 1 And DayNum <> 7) Then NumOfWorkDays = NumOfWorkDays + 1
Next
CalcWorkDays = NumOfWorkDays
End Function
JR
-----Original Message-----
From: Christopher Hawkins [mailto:clh at christopherhawkins.com]
Sent: Wednesday, March 31, 2004 12:34 PM
To: accessd at databaseadvisors.com
Subject: [AccessD] Needed: GetBusinessDays(Date1, Date2)
I am utterly shocked that a Google search on GetBusinessDays turned
up squat.
Anyways, I need an Access VBA function that will return the number of
business days (Mon - Fri) between two dates. I know this is the type
of stuff that's supposed to be all over the net, but I am finding
nothing.
Heeeeeeeeeeelp...
-Christoher Hawkins-
--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
This electronic transmission is strictly confidential to TNCO, Inc. and
intended solely for the addressee. It may contain information which is
covered by legal, professional, or other privileges. If you are not the
intended addressee, or someone authorized by the intended addressee to
receive transmissions on behalf of the addressee, you must not retain,
disclose in any form, copy, or take any action in reliance on this
transmission. If you have received this transmission in error, please notify
the sender as soon as possible and destroy this message. While TNCO, Inc.
uses virus protection, the recipient should check this email and any
attachments for the presence of viruses. TNCO, Inc. accepts no liability for
any damage caused by any virus transmitted by this email.