JohnnyProd
Technical User
How can I reference a label in a report without hardcoding the name?
ex: 'Reports![myReport]!lblDate.Caption = strHeader'
I've tried creating a <b>Report</b> object named myReportObject and then referencing it like 'myReportObject!lblDate.Caption = strHeader'. Unfortuantely, I am having probelms creating the <b>Report</b> object. Any tips? Here's an example of the code I am trying to implement.
reportName="myReport"
DoCmd.OpenReport reportName, acDesign
Report myReport = Reports![Open Cursors]
Reports![myReport]!lblDate.Caption = strHeader
Reports![myReport]!lblDate.FontSize = fntSize
Reports![myReport]!Graph2.RowSource = sqlString
DoCmd.Close acReport, reportName, acSaveYes
DoCmd.OpenReport reportName, acPreview
ex: 'Reports![myReport]!lblDate.Caption = strHeader'
I've tried creating a <b>Report</b> object named myReportObject and then referencing it like 'myReportObject!lblDate.Caption = strHeader'. Unfortuantely, I am having probelms creating the <b>Report</b> object. Any tips? Here's an example of the code I am trying to implement.
reportName="myReport"
DoCmd.OpenReport reportName, acDesign
Report myReport = Reports![Open Cursors]
Reports![myReport]!lblDate.Caption = strHeader
Reports![myReport]!lblDate.FontSize = fntSize
Reports![myReport]!Graph2.RowSource = sqlString
DoCmd.Close acReport, reportName, acSaveYes
DoCmd.OpenReport reportName, acPreview