Combo box Questions

xxlu

Registered User.
Local time
Today, 09:00
Joined
Jun 28, 2001
Messages
12
I use combo box to search existing customers to enter into order form. But combo box just can display one field, either CustomerID or Name. But Name can not identify a customer cause sometimes two customers have same surname and first name. My solution is to use customerID to identify customer, but I want user can see the name at the same form cause name is more meaningful for user. I want to design control to set value of customer name automatically after the customerID is selected in the combo box. How to write coding for this functions. Please good people help! Thanks very much.
 
I think I know what you're asking....

If opening the combo box displayed two columns: the ID and the name, would that do what you want?

To do so, edit the row/source property of the combo box to:
SELECT DISTINCTROW [YourQuery].[CustomerID], [YourQuery].[CustomerName]FROM [YourQuery];

Set the Bound Column property to 1 (if you want the ID, 2 if you want the name).
 
Thanks, ListO.

I tried, but still there is problem. I set Bound Column Property to 3 for I want to display Name (Column Count is 3). But it still display CustomerID. I tired to set Bound Column to 1 or 2 or 3. Sometimes it can display Name, but when I enter next record, it returns to display CustomerID again. Please Help. Thanks a lot.
 
Ok, your problem is this...
For the columns, the bound column is 0, and then the next column is 1, e.t.c

So, when setting up your combobox(row source) put the customer ID in the bound column, and the customer name in Column 1.

Now, set the following properties for the combo box:

Column Count = 2
Column Widths = 0";1"

This will enable you to search via picking the customers name, but the records will be brought up using the customer ID.

HTH

Angelo

p.s. If you need any additional help just ask
 

Users who are viewing this thread

Back
Top Bottom