Requery a subform using a command button

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?
 
D

Dirk Goldgar

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top