Wrox Programmer Forums Calculate Business Days - MS access 97
 | Search | Today's Posts | Mark Forums Read
 Access VBA Discuss using VBA for Access programming.
 Welcome to the p2p.wrox.com Forums. You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com

October 13th, 2004, 02:13 PM
 Authorized User Join Date: Jun 2004 Location: , , . Posts: 22 Thanks: 0 Thanked 0 Times in 0 Posts
Calculate Business Days - MS access 97

Help! I have a module that shows how to calculate business days. However, I don't know how to refer to it.

I have a table (named ITEMS) with values
1 1/1/2004 2/3/2004
2 2/1/2004 1/31/2004
3 3/3/2004 3/6/2004

Using the information from the table, I need to calculate the net business days between received and submitted for each record.

Then I need to actually sum the total business days for all rows and calculate an average number of business days for the entire table. I need this information in a report. How can I do this?

Here's the module I'm using:

On Error GoTo Err_WorkingDays

Dim intCount As Integer

'ReceviedfromIRS = ReceviedfromIRS + 1
'If you want to count the day of ReceviedfromIRS as the 1st day
'Comment out the line above

intCount = 0
Do While ReceviedfromIRS <= DateSubmitted
'Make the above < and not <= to not count the DateSubmitted

Select Case WeekDay(ReceviedfromIRS)
Case Is = 1, 7
intCount = intCount
Case Is = 2, 3, 4, 5, 6
intCount = intCount + 1
End Select
ReceviedfromIRS = ReceviedfromIRS + 1
Loop
WorkingDays = intCount

Exit_WorkingDays:
Exit Function

Err_WorkingDays:
Select Case err

Case Else
MsgBox err.Description
Resume Exit_WorkingDays
End Select

End Function

Thanks!

 Similar Threads Thread Thread Starter Forum Replies Last Post Calculate # of work days ? kscase SQL Server 2005 3 June 9th, 2007 09:11 PM How to calculate a number of days between 2 date windy417 Pro JSP 1 July 20th, 2006 07:09 PM Help for Last 30 Business Days Query srinath2003 SQL Server 2000 3 March 21st, 2005 02:37 PM DCOUNT Issue - MS Access 97 snoopy92211 Access VBA 1 October 12th, 2004 02:38 AM How to calculate the work days beetwen two dates. andres_pm Javascript 1 October 7th, 2004 06:23 AM