select query

  • Thread starter Thread starter gal
  • Start date Start date
G

gal

Hi group,

I have two queries. How do I have theuser pick one of them
and then by clicking teh cmdButton the form runs report.

I thought of creating a combo box, but how do I set the
combo box or (and) cmdButton to run the chosen query.

Thank you

Galin
 
Hi,

The recordsource property of the report can be change when you load it.
With most recent Access versions, you can use the OpenArgs argument to
specify the SQL text, or the query name:


DoCmd.OpenReport "ReportName", OpenArgs:="SELECT ... "



and, in the Open event of the report:


Private Sub Report_Open(Cancel As Integer)
Me.RecordSource = Me.OpenArgs
End Sub




You just have to use the right DoCmd statement under the click event of the
appropriate button.



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top