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

Referencing Column #2 in Multi Select Listbox 1

Status
Not open for further replies.

lcapece

MIS
Jan 11, 2001
6
US
Help:
I have a multiselect listbox with 2 colums, when looping throgh the .itemdata of the .selected collection, I need to reference both Column #1 and #2 current selected values. Not sure if you use the .column property, which I can not get to work at all.
Any help is much appreciated.

Louis Capece
Systemax Corp.
 

This is what I would do. It may not be the best way, but it might work.

-Create a hidden textbox control.
-In the control source property for that control, make that equal your combo box. ex. =[comboBox1]
(this will get one column for your combo box)
-whenever you choose an item from the combo box, the textbox will equal that item.
-in the bound column property for the combo box, choose the other column that is not referenced by the hidden textbox control.
-and just reference both the combo box and the hidden text box

Hope this helps

Ramon
 
This example uses a MultiSelect ListBox (lstNames) with two columns, one for last name and one for the first name, then displays a message box for each item that is selected in the ListBox. ..... Column is a Zero Based index......

Dim ctl As Control
Dim varItm As Variant
Set ctl = Me!lstNames
For Each varItm In ctl.ItemsSelected
MsgBox ctl.Column(0, varItm) & ": " & ctl.Column(1, varItm)
Next varItm
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top