Combo Box Selection

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am very new to Access
I have created a Combo Box (from a table) with 2 fields Product Name and product price
I have the CBox bound to the price column, so that the price is transferred to another field when they select the product
When the user selects the product - the product shows in the combobox window and the price shows in the field it is transferred to
Works fine until 2 products have the same price. Then it defaults to the product that is listed first in the table and shows that in the Cbox window. Many products will have the same price, is there a way to get the selected product name to appear in the Cbox window

Thank you for any help
 
Hello Andrea,

Look in the Column Widths Property of the combo box. If the order of the
columns in the combo box is Product Name, then Product Price, then I suspect
that the Column Widths property shows a 0" as its first number. Try
changing that number to 1" or whatever non-zero value looks good; that
should make the Product Name appear.

Post back and let us know...

--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


andrea said:
I am very new to Access.
I have created a Combo Box (from a table) with 2 fields Product Name and product price.
I have the CBox bound to the price column, so that the price is
transferred to another field when they select the product.
When the user selects the product - the product shows in the combobox
window and the price shows in the field it is transferred to.
Works fine until 2 products have the same price. Then it defaults to the
product that is listed first in the table and shows that in the Cbox window.
Many products will have the same price, is there a way to get the selected
product name to appear in the Cbox window.
 
Cheryl
Thanks for the reply. I do have the width set to .5
A product name does show. The problem I am having is when the price is the same as another product, then the selection is defaulting to the first listed product with that price. I think it is because I have the Cbox bound to the price. I need the price to be transferred when the selection is made. Maybe I need togo about that another way?

Thanks for any help
 
There is another way which involves a bit of VBA code:

1. Make sure that the Row Source of your combo box has Product Name as the
first column and Price as the second.

2. Bind the combo box to the Product Name field in the query or table which
underlies your form by setting the Bound Column property of the combo box to
1.

3. If you do not already have a separate control on your form which is
bound to Price, create one on the form.

4. In the After Update event of your combo box, insert the following code:

Me!Price = Me!MyComboBox.Column(1)

If this does not work for you, please post back with more details, including
the SQL code for the Row Source of your combo box, etc.



--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Andrea said:
Cheryl,
Thanks for the reply. I do have the width set to .5"
A product name does show. The problem I am having is when the price is
the same as another product, then the selection is defaulting to the first
listed product with that price. I think it is because I have the Cbox bound
to the price. I need the price to be transferred when the selection is made.
Maybe I need togo about that another way??
 
Back
Top