snoopy92211
Technical User
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!
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!