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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate Combo Box with data in a recordset

Status
Not open for further replies.

marydn

Programmer
Mar 26, 2001
152
US
Hi,

I created a recordset with data specified by the user. Now I want to put some of that data (3 fields) in a combo box. How do I do that?

Thanks! :)
 
Thanks Steve, but I was looking for something more like this:

With rst
If Not .EOF Then
txtSiteType = !siteType
cboSite.Column(0) = ![SBA Site Code]
cboSite.Column(1) = !SiteName
End If
End With

I want to loop through the recordset and populate the combo box with several fields from the recordset. I keep getting errors. Any help would be so wonderful.
 
Another approach is to build a value list and store it to a variable. Then set the combo-box value list to that variable. This is just a guess... never did it before...

1,field1,2,field2,3,field3...

Not really sure if you are merging some of the data entered by the user with another record set from a table or not per your response. If that is the case, create a temporary table that can serve as a repository of information that can feed the combo-box.

htwh...

Steve Medvid
"IT Consultant & Web Master"
 
This worked for me. Set the RowSourceType to Value List.

Do While Not rst.EOF
strList = strList & rst.Fields("Item").Value & ","
rst.MoveNext
Loop

cboItem.RowSource = strList
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top