Can we put two or three sets of data into one combobox?

  • Thread starter guangdew via AccessMonster.com
  • Start date
G

guangdew via AccessMonster.com

In my database, I have Products table and Orders_Details table that contains
Product_ID field and they have one to many relationship.

On Orders_Details subform, I have a combobox Product_ID which is a bound
control. From the pulldown list, I can have Product_ID, Product_Name and
Price listed. After whichever product is selected, I want the combobox to
display both Product_Name and Price but it can show only the Product_Name
field.

I’m also thinking of use another unbound field to display the price
separately, but I have problem making it work.

Can anyone make some suggestions to me?

Thanks,

Guangdew
 
B

BruceM via AccessMonster.com

The combo box displays only the bound column after the selection, although
the drop-down list can display several columns. Use text boxes to display
other columns. In the Control Source of a text box, something like:

=[ComboBoxName].Column(1)

Column numbering is zero-based, so Column(1) is actually the second column.

BTW, price is often a value that needs to be stored so that it shows the
price at the time of the transaction, which is not necessarily the current
price. In that case you can use the After Update event to the combo box:

Me.SalePrice = Me.ComboBoxName.Column(2)

SalePrice is a field name.
 
T

Tom van Stiphout

On Tue, 16 Feb 2010 07:21:29 GMT, "guangdew via AccessMonster.com"

A better idea is to display the price in a textbox next to the
combobox, and set its controlsource to:
=myCombobox.Column(2)
(of course you replace myObjectNames with yours)

-Tom.
Microsoft Access MVP
 
G

guangdew via AccessMonster.com

I tried it, it works. Thank you for your help.

Guangdew
A better idea is to display the price in a textbox next to the
combobox, and set its controlsource to:
=myCombobox.Column(2)
(of course you replace myObjectNames with yours)

-Tom.
Microsoft Access MVP
In my database, I have Products table and Orders_Details table that contains
Product_ID field and they have one to many relationship.
[quoted text clipped - 13 lines]
 
G

guangdew via AccessMonster.com

The "=[ComboBoxName].Column(1)" method works fine, thank you for your help.

This Price is actually list price, so it's a field in Products table. I just
want it to be displayed here as reference. Sale_Price is a bound control to
write into Order table that need to be entered in the Orders form.

Guangew
The combo box displays only the bound column after the selection, although
the drop-down list can display several columns. Use text boxes to display
other columns. In the Control Source of a text box, something like:

=[ComboBoxName].Column(1)

Column numbering is zero-based, so Column(1) is actually the second column.

BTW, price is often a value that needs to be stored so that it shows the
price at the time of the transaction, which is not necessarily the current
price. In that case you can use the After Update event to the combo box:

Me.SalePrice = Me.ComboBoxName.Column(2)

SalePrice is a field name.
In my database, I have Products table and Orders_Details table that contains
Product_ID field and they have one to many relationship.
[quoted text clipped - 13 lines]
 
G

guangdew via AccessMonster.com

The "=[ComboBoxName].Column(1)" method works fine, thank you for your help.

This Price is actually list price, so it's a field in Products table. I just
want it to be displayed here as reference. Sale_Price is a bound control to
write into Order table that need to be entered in the Orders form.

Guangew
The combo box displays only the bound column after the selection, although
the drop-down list can display several columns. Use text boxes to display
other columns. In the Control Source of a text box, something like:

=[ComboBoxName].Column(1)

Column numbering is zero-based, so Column(1) is actually the second column.

BTW, price is often a value that needs to be stored so that it shows the
price at the time of the transaction, which is not necessarily the current
price. In that case you can use the After Update event to the combo box:

Me.SalePrice = Me.ComboBoxName.Column(2)

SalePrice is a field name.
In my database, I have Products table and Orders_Details table that contains
Product_ID field and they have one to many relationship.
[quoted text clipped - 13 lines]
 
G

guangdew via AccessMonster.com

The "=[ComboBoxName].Column(1)" method works fine, thank you for your help.

This Price is actually list price, so it's a field in Products table. I just
want it to be displayed here as reference. Sale_Price is a bound control to
write into Order table that need to be entered in the Orders form.

Guangew
The combo box displays only the bound column after the selection, although
the drop-down list can display several columns. Use text boxes to display
other columns. In the Control Source of a text box, something like:

=[ComboBoxName].Column(1)

Column numbering is zero-based, so Column(1) is actually the second column.

BTW, price is often a value that needs to be stored so that it shows the
price at the time of the transaction, which is not necessarily the current
price. In that case you can use the After Update event to the combo box:

Me.SalePrice = Me.ComboBoxName.Column(2)

SalePrice is a field name.
In my database, I have Products table and Orders_Details table that contains
Product_ID field and they have one to many relationship.
[quoted text clipped - 13 lines]
 
G

guangdew via AccessMonster.com

The "=[ComboBoxName].Column(1)" method works fine, thank you for your help.

This Price is actually list price, so it's a field in Products table. I just
want it to be displayed here as reference. Sale_Price is a bound control to
write into Order table that need to be entered in the Orders form.

Guangew
The combo box displays only the bound column after the selection, although
the drop-down list can display several columns. Use text boxes to display
other columns. In the Control Source of a text box, something like:

=[ComboBoxName].Column(1)

Column numbering is zero-based, so Column(1) is actually the second column.

BTW, price is often a value that needs to be stored so that it shows the
price at the time of the transaction, which is not necessarily the current
price. In that case you can use the After Update event to the combo box:

Me.SalePrice = Me.ComboBoxName.Column(2)

SalePrice is a field name.
In my database, I have Products table and Orders_Details table that contains
Product_ID field and they have one to many relationship.
[quoted text clipped - 13 lines]
 

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