Click button show results in subform

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

Guest

I have a form that has 3 cmd buttons. Each cmd button opens and runs a
query. I would like to have a sub form in the main form that will show
the results of the query that was selected. So that on click the query
results will open in the subfrom window How do I do this?
 
On the click event for each button, set the SourceObject property of the
subform control to the name of your query:

for cmdButton1_Click:
Me.sctlSubformControl.SourceObject = "qryMyQuery1"

for cmdButton2_Click:
Me.sctlSubformControl.SourceObject = "qryMyQuery2"


HTH,
George Nicholson

Remove 'Junk' from return address.
 
Thanks for the reply but I'm still not clear on one part. The
".sctlSubformcontrol." What should this be? The subform name? Sorry but I'm
new!
 
Me.sctlSubformControl.SourceObject = "qryMyQuery1"

where sctlSubformControl is the name of the control created to contain a
subform. SourceObject would normally be where you specify which form to show
as a subform within that control, but in this case there is no "form" per
se, just your query output.
 
Back
Top