I have a list of subreport names in a table. The user wants to be able to see many reports on one. I created a form with the report names and created one report that contains many subreports. The reports the user wants to see are made visible. I need to make the subreports visible using the variable. I am trying to move the report name to a string variable and call it this way:
dim rptName as string
dim rs as dao.recordset
dim cd as dao.database
dim strSQL as string
set cd = currentDB
strSQL = "Select ReportName from ReportList"
set rs = cd.openrecordset(strSQL)
For i = 1 To rs.RecordCount
rptName = rs!ReportName
Reports(rptName).Visible = False
I get an error saying that the report is misspelled or refers to a report that doesn't exist. The name of the report is correct but it has single quotes around it which may be the problem.