listbox.rowsource = ado rs?

G

Guest

I have tons of code blocks in an Access 97 app that bind the row source to a
select statement. Now I am in a process of replacing embedded sql with stored
Procs. I am able to call many type of sps from it using ado. The only thing I
have trouble with are these combo/listboxes. How could I bind them to a
recordset/dataset dynamically?

Thanks!
 
A

Albert D. Kallal

In later versions, you can stuff a reocrdset direclry right into a listbox.
And, you can use DAO, or ADO.


Dim rst As DAO.Recordset

Set rst = CurrentDb.OpenRecordset("select FirstName from contacts order
by FirstName")

Set Me.Combo0.Recordset = rst

However, you mention ado...and I am surprised that you are using ado with
a97.

At any rate, if you are in fact still using a97, then you can fill the
listbox via code, and how to do this can be found here:

http://www.mvps.org/access/forms/frm0049.htm

If you are using later versions, then you can bind the ado (or dao)
recordset directly to the combo box...
 

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