filter query by current record for combo box

G

Guest

I have a continuous form with a "productID" and a "type" combo box. The
Product can have more than one "type" for this entries.

The combo box source is a query with all types available today (the value
types change a lot). The query has a "productID" and "types" fields.

How can I filter the query (source of the combo box) by the current
"productID" on my continuos form to show only the types available for this
particular Product.

With out the filter, the combo box shows ALL types available for ALL Products.

I can't find the way to reference the 'current' "productID" on the
query's criteria.
 
M

Marshall Barton

segurarl said:
I have a continuous form with a "productID" and a "type" combo box. The
Product can have more than one "type" for this entries.

The combo box source is a query with all types available today (the value
types change a lot). The query has a "productID" and "types" fields.

How can I filter the query (source of the combo box) by the current
"productID" on my continuos form to show only the types available for this
particular Product.

With out the filter, the combo box shows ALL types available for ALL Products.

I can't find the way to reference the 'current' "productID" on the
query's criteria.


You will eventually find that this is is a complex
situation.

For the part of the problem you asked about, all you have to
do is use a criteria like:
Forms.formname.productID
for the productID field in the type combo box's row source
query.

You probably have that part already, but need to add a line
of code to the product control's AfterUpdate event procedure
and to the form's Current event:
Me.typecombo.Requery

While that will make your form and combo box work as you
want, the other rows may display blank instead of their
type. This is the part that gets messy if you really need
all the rows to display their type instead of just the rows
with the same product as the current record.
 

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