Not normally. Although many people do want to take account of holidays, many
more only want to know the number of business days, regardless of holidays.
But in case Paolo does want that, he may also like to consider the
following. It's just another way to do the same thing.
Public Function WorkingDays(dte1 As Date, dte2 As Date) As Integer
'Calculates the number of working days between two dates, taking
'account of the holidays listed in tblHolidays.HolidayDate.
Dim rs As DAO.Recordset
Dim iDays As Integer
Dim sSQL As String
iDays = DateDiff("d", dte1, dte2) - _
DateDiff("ww", dte1, dte2, 1) * 2 - _
IIf(Weekday(dte2, 1) = 7, _
IIf(Weekday(dte1, 1) = 7, 0, 1), _
IIf(Weekday(dte1, 1) = 7, -1, 0))
sSQL = "SELECT Count(*) As HolidayCount " & _
"FROM tblHolidays " & _
"WHERE HolidayDate BETWEEN #" & dte1 & "# AND #" & dte2 & "# " &
_
"AND WeekDay(HolidayDate, 2) < 6"
Set rs = DBEngine(0)(0).OpenRecordset(sSQL, dbOpenSnapshot)
WorkingDays = iDays - rs!HolidayCount
rs.Close
Set rs = Nothing
End Function
This assumes a table with the following structure:
tblHolidays
HolidayID AUTONUMBER - Primary Key
HolidayDate DATETIME
HolidayName TEXT(30)
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------