我有一个子例程,用于构建检索数据以填充日历报告。例程工作正常;但是,在报表标题中设置报表标题的代码部分不起作用。例程运行没有错误但标签为空。
目前,从输入表格中检索年份,但我确实认为这是问题,因为即使输入" 2018年安全日历"它仍然没有返回。任何建议将不胜感激。
Public Sub loadReportYearCalendar(theReport As Report)
Dim i As Integer
Dim datStart As Date
Dim rptControl As Report
Dim rptYear As String
m_strCTLLabel = "labelCELL"
m_strCTLLabelHeader = "labelDAY"
rptYear = Forms![fr_SafetyCal]![txtYear]
'Load calendar data for the specified year into the collection
Call getCalendarData
With theReport
'Get the first month of the specified year
datStart = "1/1/" & Forms![fr_SafetyCal]![cboYear]
'Add the specified year to the report's label
.Controls("labelCalendarHeaderLine2").Value = rptYear & " Safety Calender"
For i = 1 To 12
'Set pointer to subreport control hosting the mini-calendar
Set rptControl = .Controls("childCalendarMonth" & i).Report
'Run procedure to populate control with it's respective year
Call loadReportCalendar(rptControl, datStart)
'Reset and obtain first day of the following month
datStart = DateAdd("m", 1, datStart)
Next i
End With
'Clean up
Set colCalendarDates = Nothing
Set rptControl = Nothing
End Sub