Combo box to display value it's not bound to?


G

Guest

I'm not talking about the drop down list for the combo box, but rather what's
displayed in the box after a selection is made.

For example, let's say the user is selecting an employee record to view in a
"pop-up" form. The combo box would be bound to EmployeeID, the primary key.
The drop-down for the combo box might display the EmployeeID, Name, and
Department. Since the combo box is bound to EmployeeID, that is the value
that is displayed by default in the combo box after a selection is made, but
what if I want the user to see the employee's Name displayed in the box after
they've selected an employee. Can I do this?

Thanks for your time.

-ndalton
 
Ad

Advertisements

F

fredg

I'm not talking about the drop down list for the combo box, but rather what's
displayed in the box after a selection is made.

For example, let's say the user is selecting an employee record to view in a
"pop-up" form. The combo box would be bound to EmployeeID, the primary key.
The drop-down for the combo box might display the EmployeeID, Name, and
Department. Since the combo box is bound to EmployeeID, that is the value
that is displayed by default in the combo box after a selection is made, but
what if I want the user to see the employee's Name displayed in the box after
they've selected an employee. Can I do this?

Thanks for your time.

-ndalton

Set the Combo's ColumnWidths property to:
0";1";1"

As long as the first column is 0" you can size the other columns as
wide needed.
The Value stored in the table will still be the bound column, but the
combo will display the first column wider than zero (in this case your
2nd column).
 
Ad

Advertisements

G

Guest

Right click the combo in design mode.
Click the build ...'s
Construct the combo source in the order you want
- ID, FirstName, Surname, etc -
Set the bound column to 1 (if you use the fields above - ID would be 0 and
Surname would be 2)
Select the the employee you want
The 1 st name will be displayed

Hope this helps
 

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