Unbound LisbBox additems for two columns

  • Thread starter Thread starter Vic
  • Start date Start date
V

Vic

I have a listbox where I'm adding the Items
programatically. This is my code:
Do While Not rs.EOF
Me.lstClin1.AddItem rs("Clin_ID"))
rs.MoveNext
Loop

I want to add rs("Name") to a second column. How can I
do that? Please help.
 
Hi,
I haven't used the new AddItem feature but if you're simply
populating from a recordset, just use the 'regular' way and
set the data source of the combo to the query that you got your
recordset from. Then just set the appropriate properties (ColumnCount etc)
and away you go.
 
How do you this using VBA? I don't want to do any
binding because I want to be able to use the data. All I
need is for the list box to be populated when the form is
loaded. Also, my query does not exist in Access, I'm
using ADO and passing a query using code. Please let me
know if there is a better way to do this. Thank you.
 
Hi,
Here's a snippet from Help:

For multiple-column lists, use semicolons to delimit the strings for each column (for example, "1010;red;large" for a three-column
list). If the Item argument contains fewer strings than columns in the control, items will be added starting with the left-most
column. If the Item argument contains more strings than columns in the control, the extra strings are ignored.
 
Hey, that worked. Thanks...

-----Original Message-----
Hi,
Here's a snippet from Help:

For multiple-column lists, use semicolons to delimit the
strings for each column (for example, "1010;red;large"
for a three-column
list). If the Item argument contains fewer strings than
columns in the control, items will be added starting with
the left-most
column. If the Item argument contains more strings than
columns in the control, the extra strings are ignored.
 
Back
Top