## ACC1x: How to Simulate Changing RecordSource Property of Report

Q102672

The information in this article applies to:

- Microsoft Access versions 1.0, 1.1

## SUMMARY

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.

## MORE INFORMATION

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:

1. Create a new report called MyReport.
2. Create a new query called MyNewQuery, using the same fields that appear in MyReport.
3. 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.

## REFERENCES

Microsoft Access "User's Guide," version 1.0, Chapter 23

Keywords : kbusage
Issue type : kbhowto
Technology :

Last Reviewed: November 4, 2000 © 2001 Microsoft Corporation. All rights reserved. Terms of Use.