Requery a subform using a command button

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

Guest

I'm creating a form that has 3 combo boxes that are used as criteria in the
query for a subform. I'm trying to create a command button that will requery
after I've entered the values in the 3 combo boxes, but nothing I've tried so
far will bring up records in the subform.

The form is called frmTest, the subform is sfrmData and the query for the
subform is called qryData. Can anyone suggest some code that would make my
command button work?
 
Alexis0509 said:
I'm creating a form that has 3 combo boxes that are used as criteria
in the query for a subform. I'm trying to create a command button
that will requery after I've entered the values in the 3 combo boxes,
but nothing I've tried so far will bring up records in the subform.

The form is called frmTest, the subform is sfrmData and the query for
the subform is called qryData. Can anyone suggest some code that
would make my command button work?

I take it the button is on the main form? Did you try

Private Sub YourButtonName_Click()

Me.sfrmData.Form.Requery

End Sub

? That should work provided that "sfrmData" is in fact the name of the
subform control on the main form, and not just the name of the form
being displayed in that control.
 
Back
Top