Two-column combo box

John liem

Registered User.
Local time
Today, 04:03
Joined
Jul 15, 2002
Messages
112
I have a combo box with 2 columns "Customer code" and "Customer name", the "Customer code" is the bound column. 1. How can I show the value of the "Customer name" on a separate text box.
2. This combo box is used as a data entry for the new "sales", how can I validate the "Customer name" in a "tbl_sales" by just choosing the "Customer Code" from the combo box.
 
You can refer to the Name in the second column it's actually Column1, Column0 being the bound column. You can use an unbound text box to display the name if you want set its control source to
=[MyComboName].[Column](1)
 
Hi Rich, thanks
How to deal with my 2nd question?, the tbl_sales with record "Customer_name" has to capture this [combobox].[column](1) as a new record in "customer_name".
 
Don't store the customer name again, just store the CustomerID in your tbl_Sales. How you store this from the combo depends on what you are using the combo for. If it used to filter the form, you will need a separate textbox for the ID to populate the new record in the table. If not, set the controlsource to the CustomerID field in your tbl_sales.
HTH
 
Along the same lines as the original post, is there a way to get a combo box to actually display multiple columns. I have a form where I'm displaying a number (ID) a name, and then another name (if applicable) in the same combo box for a lookup form. The user uses the combo box to find the the record that they want to look at and then they open a form that displays the rest of the details of the record.

When the selection is made, the only data that stays in the combo box is the ID. I would like it to display all three.
 
You should really start a new post but to answer your question, no you cannot display more than one column in a combo. Generally, the first column (0) contains the ID and is hidden etc. I you want to display all 3, create 2 unbound textboxes adjacent to the combo. In the first, set the controlsource to =[MyComboName].[Column](1) and in the second, =[MyComboName].[Column](2). This is the usual workaround.
HTH
 
Well, thanks for that anyway, even if it isn't what I was looking for. At this point, I know just enough to get myself into deep trouble! ;)
 
You could do it (on second thoughts) using a concatenated field. In the query that supplies the combo, set the first column as the ID and hide it in the combo. In the second field of the query enter FullDetails: [ID] & " " & [Name1] & " " & [Name2]. This will display all 3 items in 1 column. Is that what you were looking for?
 

Users who are viewing this thread

Back
Top Bottom