Set the RecordSource of a report from a command button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Access I have a standard report that I would like to use for a number of queries. I am trying to figure out how I can use a command button to change the RecordSource to one of the other queries to generate the report.

Any assistance would be much appreciated
 
Jason Farrugia said:
Access I have a standard report that I would like to use for a number of
queries. I am trying to figure out how I can use a command button to change the
RecordSource to one of the other queries to generate the report.
Any assistance would be much appreciated

The best place to change the RecordSource of a Report is in its Open event. You
can have the button set the value of a hidden control on a form or use a global
variable and then in the Report's Open event have code similar to...

Select Case GlblVar
Case "This Value"
Me.RecordSource = "ThisQuery"
Case "ThatValue"
Me.RecordSource = "ThatQuery"
etc..
 
Back
Top