I wouldn't suggest using Macros in Access at all. Here is a VBA function I wrote to count DateDiff with option not to count weekends or holidays, depending on what you want to do.
Below:
__________________________________________________ __________________________________________________ _____
Code:
Function DateDiffWithExceptions(FirstDate As Date, SecondDate As Date, _
strDates As String, _
Optional ExcludeWeekends As Boolean = False) As Long
On Error GoTo errhandler
' strDates must be like this: MMDD|MMDD|MMDD| etc
' ex. 0101|0704|1127
'returns the same as DATEDIFF() function does (# of days between 2 dates)
'except it also excludes additional days specified by developer - holidays, etc.
'as long as I was at it I put in an option to exclude weekends or not, as well.
'if omitted, this arguments defaults to false (weekends are not excluded)
Dim dtLooper As Date 'generic date looping variable
Dim lngCount As Long
Dim lngYear As Long
Dim x As Long
Dim blAlreadyDeducted As Boolean
Dim strExceptions() As String
strExceptions = Split(strDates, "|")
lngCount = DateDiff("d", FirstDate, SecondDate) 'start by assigning max count. Entire interval
'eliminate some weird possibilities first, since DateDiff() does allow for negative dates,
'and since the calculation may result in 0 days elapsed, either of which would probably break further steps:
If lngCount <= 0 Then
DateDiffWithExceptions = lngCount
Exit Function
End If
dtLooper = FirstDate
Do While dtLooper <= SecondDate 'loop between dates
If ExcludeWeekends = True Then
If (Weekday(dtLooper) = 7 Or Weekday(dtLooper) = 1) Then
lngCount = lngCount - 1
End If
Else
For x = 0 To UBound(strExceptions) - 1
If Format(dtLooper, "MMDD") = strExceptions(x) Then 'then remove it due to holiday exception, and move on
lngCount = lngCount - 1
End If
Next x
End If
'then go to next date in the interval analysis
dtLooper = dtLooper + 1
Loop
DateDiffWithExceptions = lngCount
Exit Function
errhandler:
DateDiffWithExceptions = 999999999 'use this in other code to be able to recognize, react if an error occurs
Exit Function
End Function