Addressing columns in Multilist Select listbox

M

Mark A. Sam

Hello,

Iterating through a listbox, I need to address the columns of the list and
put them into a table. Is this possible? The expression
ctlList.ItemData(varItem) will give me Column(0), where I need other column
data as well.

Thanks and God Bless,

Mark A. Sam
 
M

Marshall Barton

Mark said:
Iterating through a listbox, I need to address the columns of the list and
put them into a table. Is this possible? The expression
ctlList.ItemData(varItem) will give me Column(0), where I need other column
data as well.


Mark, check out the .Column property
 
M

Mark A. Sam

Marshall,

I looked at the help for the Column Property and don't see how it applies to
multiple list box selections.

God Bless,

Mark
 
D

Douglas J. Steele

You should be able to use something along the lines of:

Sub BoundData()
Dim frm As Form, ctl As Control
Dim varItm As Variant

Set frm = Forms!Contacts
Set ctl = frm!Names
For Each varItm In ctl.ItemsSelected
Debug.Print ctl.Column(0, varItm)
Debug.Print ctl.Column(1, varItm)
Debug.Print ctl.Column(2, varItm)
Next varItm
End Sub



--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Mark A. Sam said:
Marshall,

I looked at the help for the Column Property and don't see how it applies
to
multiple list box selections.

God Bless,

Mark
 
M

Mark A. Sam

Thank you Doug.


Douglas J. Steele said:
You should be able to use something along the lines of:

Sub BoundData()
Dim frm As Form, ctl As Control
Dim varItm As Variant

Set frm = Forms!Contacts
Set ctl = frm!Names
For Each varItm In ctl.ItemsSelected
Debug.Print ctl.Column(0, varItm)
Debug.Print ctl.Column(1, varItm)
Debug.Print ctl.Column(2, varItm)
Next varItm
End Sub
 

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