Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 13th, 2004, 02:13 PM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
ID Date Received Date Submitted
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!


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 12:53 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.