Report Based on one of Many Queries

canadaboy

Registered User.
Local time
Today, 04:38
Joined
Sep 7, 2002
Messages
43
I have a report that is based on a table. Pretty straight forward so far. I have the design and layout that I like with the appropriate fields.

I have several queries that are based on that same table. Each query outputs the same fields. The only difference is that they differ greatly on their criteria. Each query could be used as the record source for the report mentioned above.

What I would like to do is open the report from VBA code and have the appropriate query be used as the record source for that report. A brute force method would be to create many different reports with the same layout and design, but each could have one of the queries mentioned above as its record source.

HOWEVER. . .

I don't want to do that because if I want to change the layout of the report, I would have to change several (around 10) reports. This would be burdensome to maintain and worse for someone else to inherit.

My REAL QUESTION is either:
1) can I dynamically change the record source of that report to be one of the queries mentioned above, AND/OR
2) when I open the report, can I have one of those queries be used to filter the records in the report. I have tried this using the filtername argument in the OpenReport command, but it did not enforce the query. All the records of the original table were reported.

Either options (and others) would be fine. ANY THOUGHTS??? ADVICE????
 

Users who are viewing this thread

Back
Top Bottom