Unbound LisbBox additems for two columns

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.
 
D

Dan Artuso

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.
 
V

Vic

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.
 
D

Dan Artuso

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.
 
G

Guest

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.
 

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