Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box Problems 1

Status
Not open for further replies.

ninash

Technical User
Jul 6, 2001
163
GB
Hi All

I have a combo box on a form that contains 3 columns,
2 of these columns are for user information and the 3rd is a reference I require in another field on the form.

However I don't know how to tell the field to access that column for the selected value in the combobox.

Can someone please help me?

Regards
Tony
 
You can reach any column of combos and lists for the selected item thru their column property:

[tt]=mycombo.column(2)[/tt]

as controlsource of a control, would return the third column of the combo (zero based), or use the after update event of the combo:

[tt]me!txtSomeBox.value=me!mycombo.column(2)[/tt]

Roy-Vidar
 
Here is an example for a two-column combo box:

Code:
    EmployeeID = cmbNewEmployee.Column(0)
    EmployeeListName = cmbNewEmployee.Column(1)
Here I am setting the field EmployeeID to the value in the first combo box column - note that this is numbered 0. EmployeeListName is set to the second column.

This technique allows you to get to individual column values from a combo box. Put this type of code in the combo box's On Exit or On Lost Focus event, or on a [Set Values] button etc.


Bob Stubbs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top