Combo box in subform

R

Ron

I've been having trouble getting a combo box in a subform
to refresh.

There is a main form (products) with two subforms
(customers and price). When I select a Product, subform-
Customers displays the customers who have ordered that
product, and subform-Price displays the price levels for
that product.

Product_ID (autonumber field) links Products to Price and
Products to Customers.

One of the fields in the Customer data is the price level
they paid for the item. I've put a combo box in that
makes it easier for users to assign price levels per
customer. The field actually stores the price-
autonumber, but the user selects based on the price
description. The combo box is based on its own query
(qryPriceDescriptions).

The problem is that it shows ALL the prices, not just the
prices for that item. I want it to display ONLY the
prices for that item.

I have tried using:
[forms]![frmProductsActive]![Product_ID]
in qryPriceDescriptions, but it simply filters by the
first product. When I select a different product, the
qryPriceDescriptions is still displaying the price levels
for the first product.

So even though the Customer subform displays correctly
(changing its list with each product), the combo box
displaying price levels (which is on the Customer
subform) does not refresh.

Any way to get it to refresh when the customer list
refreshes?

I have tried pointing qryPriceDescriptions criteria to
[forms]![frmCustomers]![Product_ID]
but this doesn't work.

Ideas? Thanks in advance.
Ron
 
S

Sandra Daigle

Combo boxes are not automatically requeried when the subform is refiltered
(by moving to another record in the parent form). Therefore you have to
requery the combo yourself. In the Current event of the Customer Subform
requery the combo:

me.cboPrice.requery

Replace 'cboPrice' with the name of the combo.
 
R

Ron

Fantastic! That did the trick!

I had tried a requery on the 'got focus' of the cbo, but
that hadn't worked. Just gotta know where to put it!

Thanks Sandra.
-----Original Message-----
Combo boxes are not automatically requeried when the subform is refiltered
(by moving to another record in the parent form). Therefore you have to
requery the combo yourself. In the Current event of the Customer Subform
requery the combo:

me.cboPrice.requery

Replace 'cboPrice' with the name of the combo.

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.
I've been having trouble getting a combo box in a subform
to refresh.

There is a main form (products) with two subforms
(customers and price). When I select a Product, subform-
Customers displays the customers who have ordered that
product, and subform-Price displays the price levels for
that product.

Product_ID (autonumber field) links Products to Price and
Products to Customers.

One of the fields in the Customer data is the price level
they paid for the item. I've put a combo box in that
makes it easier for users to assign price levels per
customer. The field actually stores the price-
autonumber, but the user selects based on the price
description. The combo box is based on its own query
(qryPriceDescriptions).

The problem is that it shows ALL the prices, not just the
prices for that item. I want it to display ONLY the
prices for that item.

I have tried using:
[forms]![frmProductsActive]![Product_ID]
in qryPriceDescriptions, but it simply filters by the
first product. When I select a different product, the
qryPriceDescriptions is still displaying the price levels
for the first product.

So even though the Customer subform displays correctly
(changing its list with each product), the combo box
displaying price levels (which is on the Customer
subform) does not refresh.

Any way to get it to refresh when the customer list
refreshes?

I have tried pointing qryPriceDescriptions criteria to
[forms]![frmCustomers]![Product_ID]
but this doesn't work.

Ideas? Thanks in advance.
Ron

.
 

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