Private Function ShowCal() As Boolean
On Error GoTo Err_Handler
'Purpose:
Dim dtStartDate As Date 'First of month
Dim iDays As Integer 'Days in month
Dim iOffset As Integer 'Offset to first label for month.
Dim i As Integer 'Loop controller.
Dim iDay As Integer 'Day under consideration.
Dim bShow As Boolean 'Flag: show label
dtStartDate = Me.txtDate - Day(Me.txtDate) + 1 'First of month
iDays = Day(DateAdd("m", 1, dtStartDate) - 1) 'Days in month.
iOffset = Weekday(dtStartDate, vbSunday) - 2 'Offset to first label for month.
For i = 0 To 41
With Me("lblDay" & Format(i, "00"))
iDay = i - iOffset
bShow = ((iDay > 0) And (iDay <= iDays))
If .Visible <> bShow Then
.Visible = bShow
End If
If (bShow) And (.Caption <> iDay) Then
.Caption = iDay
End If
End With
Next
Call ShowHighligher("lblDay" & Format(Day(Me.txtDate) + iOffset, "00"))
Exit_Handler:
Exit Function
Err_Handler:
Call LogError(Err.Number, Err.Description, conMod & ".ShowCal")
Resume Exit_Handler
End Function