Setting the report query at runtime

C

Carl Rapson

I have a rather complex crosstab query which goes down three levels. In
other words, I have two base queries that are combined into an intermediate
query, and then the crosstab query is based on the intermediate query. I
then use this crosstab query in a report.

My problem is, I need to modify one of the base (lowest level) queries at
runtime. My idea is to basically create my queries at runtime, using
temporary names, all the way up to the crosstab query; this part works. The
next part, assigning the crosstab query to a report, is causing me some
problems. I know I can't change the RecordSource of an open report object. I
tried using the CreateReport method, but that doesn't copy any of the
controls on the template report.

Is there any other way to "clone" a report, in such a state that I can
change the RecordSource and then run the report? When I am finished with the
report, I can throw it away. Any suggestions would be appreciated.

Carl Rapson
 
M

Marshall Barton

Carl said:
I have a rather complex crosstab query which goes down three levels. In
other words, I have two base queries that are combined into an intermediate
query, and then the crosstab query is based on the intermediate query. I
then use this crosstab query in a report.

My problem is, I need to modify one of the base (lowest level) queries at
runtime. My idea is to basically create my queries at runtime, using
temporary names, all the way up to the crosstab query; this part works. The
next part, assigning the crosstab query to a report, is causing me some
problems. I know I can't change the RecordSource of an open report object.

Ypu can set the report's RecordSource property, but only in
the report's Open event procedure.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top