I have a need to change the saved Report’s RecordSource property from VBA code. The record source is one of several saved queries. when the user clicks a command button on a form, the code checks which is the appropriate query to run, and then need to set the RecordSource for a specified report.
The issue I have is when I assign the RecordSource property value in VBA code, I get en error message “You cant set a record source property in print preview or after printing has started.” It seems that by assigning the value in format of:
Report_Name.RecordSource = variableName, the code causes the report to be opened.
I need to change the RecordSource property value, then run the report: DoCmd.OpenReport stDocName, acPreview.
Any help on achieving the goal of changing RecordSource property of a report from VBA code in Access 2000 is appreciated.