Dan,
Clever code...
FYI: the DateAdd and DateDiff functions already have a "w" option (weekday) that counts weekdays already, so no need to use "d" (day) and then pull out weekends manually.
As for holidays, since they vary from worksite to worksite, the easiest thing I can think of is for you to create a holidays table with fields strName, intMonth, and intDay. Omit the year because you want your table to work for reoccuring holidays.
In your code, loop through the table, construct a current holiday
dtmHoliday = DateSerial(Year(Date()), intMonth, intDay)
if it falls between the start and end dates, then subtract it from your total.
Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
|