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

Puttinf a coded recordset into a listbox 1

Status
Not open for further replies.

joebickley

Programmer
Aug 28, 2001
139
GB
Hi

I have a ADO.recorset in code that holds several rows of data. How do i make these records appear in a list box on my form. In visual basic it would just be a matter of looping through the recordset doing a "lstbox.addnew" but this is not available in access

Please help

Thanks

Joe
 
Try this. Just add a List Box name List0 to a form. You should be able to figure it out from there. Note- you must seperate each value with a semi-colon


Private Sub List0_Enter()

Dim r As Recordset
Dim s As String

Set r = CurrentDb.OpenRecordset("select name from msysobjects")

While r.EOF = False
s = s & r!Name & ";"
r.MoveNext
Wend

Me.List0.RowSourceType = "Value List"
Me.List0.RowSource = s

End Sub
 
Wouldn't it be easier just to include your recordset in the Row Source Property of the combo box as the result of a query or temporary table resulting from your recordset?

Bruce Gregory
 
I don't believe so 'cause you'd have to worry about the existence of the temporary table and then appending to that table. And the same goes for a query. What makes you think it'd be easier?
 
I'll stand down, I wasn't trying to compete with anyone, just trying to pass a thought to the originator.
 
HI both thanks for your replies

As one of you mentioned creating temp table and such would be a bind and i am trying to streamline the process as much as posible cos of our crap network. The recordset comes from a SQL server stored procedure so that takes on all the temp table creating as it is.

Pezamystik's idea works to a point and i was going to go with this but unfortunately the amount of data im trying to put in is to big for the method it falls over.

Had to use a form in the end :( thanks agin for all your responses

joe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top