changing the recordSource of a report

D

dshemesh

Hello,
I have a report in which I would like to change the record source using
visual basic. That is, in a specific form, if the user presses button1 then
the report would open with Table1 as it's recordSource, and if the user
presses button2 the same report would open with Table2 as it's recordSource.
Any way of doing that?
thank you
 
R

Rick Brandt

dshemesh said:
Hello,
I have a report in which I would like to change the record source
using visual basic. That is, in a specific form, if the user presses
button1 then the report would open with Table1 as it's recordSource,
and if the user presses button2 the same report would open with
Table2 as it's recordSource. Any way of doing that?
thank you

The Report can change its own RecordSource in its Open event. You need a
public variable, a control on an open form, or a value passed in OpenArgs
(newest versions only) so that the report's Open event can evaluate that to
determine which RecordSoiurce to use.
 
R

Rick Brandt

dshemesh said:
thanks.
How do I pass a value using OpenArgs?


If your version of Access supports it then OpenArgs will be an optional argument
to the OpenReport Method (probably the final argument).
 
Top