query with varying WHERE

  • Thread starter Thread starter Harry van Rijn
  • Start date Start date
H

Harry van Rijn

I have an order_detail subform based on order_detail_query.
Only the details corresponding to an order from the mainform are
displayed, that's fine.

There is a combobox in the order_detail filled with products_table.
Now when I open the combo, ALL products are listed, but I only want to
see the products of 1 supplier. I guess that I need to parametrize the
order_detail_query, but how should that be done?
The supplier id is present in: forms!mainform!suppliers_id
 
Harry,

In the query that feeds you combobox you could add
"forms!mainform!suppliers_id
" into the query criteria line. There are other methods, but
this should work if this is the only place that query is
used. If not, you could create a new one for the purpose.

Gary Miller
Sisters, OR
 
Gary gave you the easiest answer. Also, in the AfterUpdate event of the suppliers_id
control, you will probably need to requery the combo box.

Me.NameOfSubformControl.Form.cboCombobox.Requery

This may not be necessary if the subform is already requerying itself when you make this
change. The NameOfSubformControl is the name of the control on the main form that holds
the subform, not the name of the subform itself.
 
Back
Top