add a filter to combo box

G

Guest

I am creating a purchase order form. In this form I used a combo box to chose
a MFG. On a subform I have a combo box (cboItemsOrdered). In this combo box
query I would like to add a filter for only the items sold by the MFG that
was chosen on the parent form (PurchaseOrder). How do I add this filter to my
combo box (cboItemsOrdered)?
 
M

Marshall Barton

cacacaconnie said:
I am creating a purchase order form. In this form I used a combo box to chose
a MFG. On a subform I have a combo box (cboItemsOrdered). In this combo box
query I would like to add a filter for only the items sold by the MFG that
was chosen on the parent form (PurchaseOrder). How do I add this filter to my
combo box (cboItemsOrdered)?


One way is to set cboItemsOrdered's RowSource query to use
the criteria Forms!PurchaseOrder.cboMFG

You will also need to add a line of code to both the
cboMFG'a AfterUpdate and the form's Current event
procedures:
Me.subformcontrol.Form.cboItemsOrdered.Requery
 
G

Guest

Thanks for your help Marshall, but I'm not understanding the
"Me.subformcontrol.Form.cboItemsOrdered.Requery"
can you explain this a little more?
 
M

Marshall Barton

That is a line of VBA code. It tells Access to requery the
combo box's RowSource query so it stays in sync with the
value in the main form's combo box. You need to replace
"subformcontrol" with the name of the main form subform
**control** that contains the form object you are using as a
subform.
 

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

Similar Threads


Top