Building Multi Column Lists

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

Just look for some help.

To programatically build a list you need to use the AddItem method :-

Me.List92.AddItem "Fred"
Me.List92.AddItem "Bert"

Does anyone know how to add an item to a list where the list has more than
one column?

Something like :-

Me.List92.AddItem.Column(0) "Fred", Column(1) "Green"
Me.List92.AddItem.Column(0) "Bert", Column(1) "Red"

Thanks.
 
Andy said:
Just look for some help.

To programatically build a list you need to use the AddItem method :-

Not necessarily. All the AddItem method does is concatenate entries,
separated by semi-colons into the list/combo's RowSource property. If you
have such a list already (in a string, say), you can do:

Me.List92.RowSource = strMyString
Me.List92.AddItem "Fred"
Me.List92.AddItem "Bert"

Does anyone know how to add an item to a list where the list has more than
one column?

In a two-column listbox or combobox with a RowSourceType property of 'Value
List', if you were to do:

Me.List92.RowSource = "Fred;Bert"

then Fred will appear in column 0 (ie the first column) and Bert will appear
in column 1 (the 2nd col). Keep repeating with pairs of values.
 
Back
Top