listbox.rowsource = ado rs?

  • Thread starter Thread starter Guest
  • Start date Start date
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!
 
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...
 
Back
Top