Hey MichaelRed,
Since you mention not wanting to manually update your Holiday tables....I started on some code, posted below, that will do most of it for you....the code is correct.
There are two basic holiday types...fixed date, such as New Years and Veterans Day, and flotaing holidays, such as Thanksgiving. What I did some time agao, was write this code, then did a Google search and found out which holidays were fixed and what holidays were floating and how they were determined. I plugged these holiday properties into a table and fed them through the code as appropriate and viola...I had accurate dates for all holidays. I checked these calculations for all dates between 1990 2020...and they were all correct.
Easter was some freakish calculation...but I found the calculation somewhere and just fed Easter in separately...I don't have the bit of code that did the actual saving of the holiday dates into the final table, but you should be able to make it....let me know.
Public Function FixedHoliday(intYear As Integer, intMonth As Integer, intDay As Integer) As Date
FixedHoliday = DateSerial(intYear, intMonth, intDay)
End Function
Public Function FloatingHoliday(intYear As Integer, intMonth As Integer, intWeek As Integer, _
intDayOfWeek As Integer) As Date
FloatingHoliday = DateSerial(intYear, intMonth, (8 - WeekDay(DateSerial(intYear, intMonth, 1), _
(intDayOfWeek + 1) Mod 8)) + ((intWeek - 1) * 7))
End Function
Public Function WeekDaysPerMonth(intYear As Integer, intMonth As Integer, _
intDayOfWeek As Integer) As Integer
Dim i As Integer
Dim intTotalDays As Integer
Dim intWeekDayCount As Integer
intWeekDayCount = 0
intTotalDays = Day(DateAdd("d", -1, DateSerial(intYear, intMonth + 1, 1)))
For i = 1 To intTotalDays
If WeekDay(DateSerial(intYear, intMonth, i)) = intDayOfWeek Then
intWeekDayCount = intWeekDayCount + 1
End If
Next i
WeekDaysPerMonth = intWeekDayCount
End Function
Public Function EasterDate(intYear As Integer) As Date
Dim i As Integer
i = (((255 - 11 * (intYear Mod 19)) - 21) Mod 30) + 21
EasterDate = DateSerial(intYear, 3, 1) + i + (i > 48) + 6 - _
((intYear + intYear \ 4 + i + (i > 48) + 1) Mod 7)
End Function
****************************
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)
Robert L. Johnson III
MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com