Public Sub FillMonthLabels(frm As Access.Form, theYear As Integer)
Dim ctl As Access.Label
Dim i As Integer
Dim amonths() As Variant
Dim theMonth As Variant
Dim FirstDayOfMonth As Date 'First of month
Dim DaysInMonth As Integer 'Days in month
Dim intOffSet As Integer 'Offset to first label for month.
Dim intDay As Integer 'Day under consideration.
Dim monthCounter As Integer
Const ctlBackColor = -2147483616 'Used for Holiday shading/Unshading
amonths = Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
For monthCounter = 1 To 12
FirstDayOfMonth = getFirstOfMonth(theYear, monthCounter)
DaysInMonth = getDaysInMonth(FirstDayOfMonth) 'Days in month.
intOffSet = getOffset(theYear, monthCounter, vbSaturday) 'Offset to first label for month.
For i = 1 To 37
Set ctl = frm.Controls("lbl" & amonths(monthCounter - 1) & i)
ctl.Caption = ""
ctl.BackColor = ctlBackColor 'reset the backcolor
intDay = i - intOffSet 'Transforms label number to day in month
If intDay > 0 And intDay <= DaysInMonth Then
ctl.Caption = intDay
If intDay < 0 And intDay <= DaysInMonth Then 'added
ctl.Visible = false
End If 'added
If isHoliday(FirstDayOfMonth + (intDay - 1)) Then ctl.BackColor = 16776960 'Color holiday backcolor Blue
End If
Next i
Next monthCounter
End Sub