Combo Box Selection Description

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

Guest

Hey Everyone,

Ok, I have a combo box with codes on it. Its pulling from a table that has
the codes and thier corresponding descriptions. I have a text box next to the
combo box I want the text box to show the description of the selection made
in the combo box. I dont know if this makes a difference but the control
source for the form is different than the the control source for the combo
box... hope that makes sense, Im a noob. Thanks All


James O
 
You don't need a combo and a text box for this. The combo can show both
while only storing the ID.

1) Create a query based on your Code & Description table (lets call it
Products):
(Open the query designer, View>SQL and paste in the following)
SELECT Code, Description,
Code:
 & " - " & [Description] As Combined
FROM Products
ORDER BY Code
2) Save this query. (Lets call it qcboProductCodes)
3) Set the properties of your combo as follows:
ControlSource: the name of the field in the form's underlying table
where you want to store the [Code] value
RowSource: qcboProductCodes
RowSourceType: TableQuery
ColumnCount: 3
BoundColumn: 1 (this will store the [Code] query value in the designated
ControlSource field)
Column Widths: 0, 0, 3" (this will hide the Code and Description
columns, but show the "Combined" value)
Width: 3"

If you need to get one of the values from the current combo selection
somewhere else in your code:
Combo.Value or Combo.Column(0) = [Code]
Combo.Column(1) = [Description]
Combo.Column(2) = [Combined]


HTH,
 

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

Back
Top