Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate list box with recordset?

Status
Not open for further replies.

utc13

Programmer
Oct 25, 2001
43
US
I have a list box that I want to populate using data from an ADO recordset that is currently open in memory. How do I go about doing this? I am familiar with using tables, queries, and even SQL statements to populate, but I've never used a recordset. Please help!
 
Heres some code that fills a list box with queries that a user has made. I use DAO but I think ADO is pretty similar. Make sure you set the row source type to Table/Query
Dim strSQL As String
Dim db As DAO.Database
Dim rs As DAO.Recordset

strSQL = "SELECT QueryID, QueryName FROM tblQuery WHERE UserName = '" & gTheUsersName & "'"

List1.RowSource = strSQL

cheers,
Ewen.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top