Microsoft KB Archive/102672
ACC1x: How to Simulate Changing RecordSource Property of Report
The information in this article applies to:
- Microsoft Access versions 1.0, 1.1
Although you cannot actually change the RecordSource property of a report, you can simulate the change by using a OpenReport macro action and calling a different query source from the Filter Name argument.
The Filter Name argument must reference a query that contains the same number of fields (with the same names) as appear in the existing report. If the fields do not exist in the query, the report may display the "#Name?" error message for controls bound to those fields.
To simulate changing the RecordSource property of a report called MyReport, do the following:
- Create a new report called MyReport.
- Create a new query called MyNewQuery, using the same fields that appear in MyReport.
Create a macro with one action as follows:
OpenReport ----------------------- Report Name: MyReport View: Print Preview Filter Name: MyNewQuery
NOTE: A SQL statement cannot be substituted for the query name.
Using this method, you can use the same report to print data from multiple data sources.
Microsoft Access "User's Guide," version 1.0, Chapter 23
Keywords : kbusage
Issue type : kbhowto
Last Reviewed: November 4, 2000