Prolly easy question: putting values in listbox

Prolly easy question: putting values in listbox

Post by Doug » Fri, 15 Dec 2000 02:28:49



I have a recordset, from an mdb, using a query string.

set rs = db.openrecordset("select * from tbl)

How can I populate a list box based on that recordset?

Thanks,

DougB

 
 
 

Prolly easy question: putting values in listbox

Post by Roni Shwek » Fri, 15 Dec 2000 19:30:13


Do While Not rs.EOF
    LstBox.AddItem rs!field_name
    LstBox.ItemData(LstBox.NewIndex) = rs!RecID
    rs.MoveNext
Loop

The 3rd line with .itemdata is optional, in the case you need to keep track
of the record source of every row in the list.

Roni


Quote:> I have a recordset, from an mdb, using a query string.

> set rs = db.openrecordset("select * from tbl)

> How can I populate a list box based on that recordset?

> Thanks,

> DougB


 
 
 

1. Easy ListBox Questions

1.  You can easily tie a list box to a table so that when you click on an
item in the list, the record pointer moves.  However, how the heck do you
make the listbox index move if the user moves the record pointer in the
table by some other means???  (Would be nice to just set a property of the
listbox and not write any search code.)

 2.  Is there any way to insert a seperator (a line) into the standard
listbox?

P. Weisberg

2. Printing Characters.

3. VB3: Setting listbox based on value of other listbox

4. MYSQL

5. Putting CSV items into a listbox

6. Question about customizing the output of a query...

7. putting the results of a query into a listbox

8. HELP with TTable?

9. INSERT VALUES easy question

10. Easy to see, hard to put in SQL

11. Give this newbe easy answers on easy questions!

12. Easy to see, hard to put in SQL

13. What is easiest way to put Access database to web, is it ASP+SQL+Javascript