Report record source

J

John

Hi

Is it possible to change the record source query of a report at runtime via
code so the report can work with different data source queries?

Thanks

Regards
 
D

Douglas J. Steele

Sure. In the report's Open event, set its RowSource to whatever you want.
 
J

John

If I am opening the report using OpenReport, how can I pass it the name of
query to open in Open event?

Thanks

Regards
 
J

Jamey Shuemaker

if you're running A2K2 or later, you can use OpenArgs. otherwise you'll
have to monkey around with the 3rd and 4th arguments of the OpenReport
method (FilterName and WhereCondition).
 
J

John

I am using a2k. Any example of using FilterName or WhereCondition for this
purpose?

Thanks

Regards
 
U

UpRider

I handle this by setting the report's record source to qtempQuery and then
creating the appropriate qtempQuery just before opening the report.

HTH,
UpRider
 
D

Douglas J Steele

Neither FilterName nor WhereCondition would be appropriate for that.

You could use UpRider's suggestion, or you could use a global variable that
you use in the Open event.
 

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