query with varying WHERE

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
 
G

Gary Miller

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
 
W

Wayne Morgan

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.
 

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