Hi
I have created a form with an options group to generate a report. Each option has a filter and then opens the same report with the selected filter.
I would like to change the title of the report based on the option the user selected. I have tried the following code.
Select Case Me.optActivities
Case 1
varWhere = "[TableCaptain] Like '-1*'"
Reports![rptTableCaptainReport]!txtActivityCaption.ControlSource = "='Table Captain'"
DoCmd.OpenReport "rptTableCaptainReport", acViewPreview, , varWhere
When I do this, I get a Run Time Error 2451 "The Report Name rptTableCaptainReport you entered is misspelled or refers to a report that isn't open or doesn't exist. If I place the control source line after the open report code, then I get an error message stating that "You can't set the control source property in print preview or after printing has started."
I would greatly appreciate any help you can offer.
Thanks
S.
I have created a form with an options group to generate a report. Each option has a filter and then opens the same report with the selected filter.
I would like to change the title of the report based on the option the user selected. I have tried the following code.
Select Case Me.optActivities
Case 1
varWhere = "[TableCaptain] Like '-1*'"
Reports![rptTableCaptainReport]!txtActivityCaption.ControlSource = "='Table Captain'"
DoCmd.OpenReport "rptTableCaptainReport", acViewPreview, , varWhere
When I do this, I get a Run Time Error 2451 "The Report Name rptTableCaptainReport you entered is misspelled or refers to a report that isn't open or doesn't exist. If I place the control source line after the open report code, then I get an error message stating that "You can't set the control source property in print preview or after printing has started."
I would greatly appreciate any help you can offer.
Thanks
S.