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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box with 2 columns

Status
Not open for further replies.

awelch

Technical User
Apr 24, 2002
85
0
0
US
Is there a way to load a combo box from a SQL db with 2 columns of information? I have a select statement that is pulling these fields from the db: YardID and Yard, but I am unsure on how to get both fields into the combo box in column format.

Any help would be greatly appreciated.

Andrea
 
Visual Basic's combo boxes do not have support for multiple columns. You could add both fields to a combo box but they will both have to be in a single column.
 
Use the ItemData Property to hold the YardID


Loop through the Objects

Combo1.AddItem Object.Yard
Combo1.ItemData(Combo1.NewIndex) = Object.YardID

Private Sub Combo1_OnClick()

Msgbox Combo1.ItemData(Combo1.ListIndex)

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top