I am using the string variable ReportName which contains the name of a report "Rpt_MonthlyReport121231". (The reason for the variable is that the name of the report changes every month.)
It works great when used in the statement: DoCmd.OpenReport ReportName, acViewPreview, , "HHID=" & ClientNowPrinting
However it does not work in this statement: Totalpages = Reports![ReportName].Pages
I discovered the reason is that the latter statement can't accept the QUOTATION MARKS around the name of the report. (The statement works fine if I simply write Rpt_MonthlyReport in the brackets without quotes)
How can I use the variable and eliminate the quotes?