I am trying to take fields from n access database and place them in a listbox on my vb form can I do this and how
the names of the fields are songname1, songname2, songname3 ...
can I set up a loop to deal with this ?
Johnny, what d'ya mean Barq's has bite? Johnny?
;P
Well, it all depends on how you're accessing hte access database. If you're using an ADODB control on your form, then all you have to do is point the ListBox.DataSource and ListBox.DataField properties to that control.
However, if you're doing it in code (which I prefer over those ADODB toys) then what you should do is create a connection to the db in code, then create a recordset based off of what you want to fill the listbox with
("Select * From SongNames", and then use your loop to cycle through the recordset and fill the listbox.
For Not rs.EOF
ListBox.AddItem rs.Fields("SongName"
rs.MoveNext
Next
Thats off the top of my head, and may not be syntactically correct, but you get the idea. Let me know if I can help any further,
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.