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

How to put records in a DBList1 2

Status
Not open for further replies.

itmasterw

Programmer
Apr 13, 2003
147
US
Hi,
I tryig to show all the records from a select statement in a lstbox.
In Access you can do something like this:

Me!lstOPut.RowSource = "SELECT Customer,User, Name, [Q8 Verb], Department FROM testTable"

but the only this that has a RowSource property is a Dblist control. But dooing the samething does not seem to work; that is :

DBList1.RowSource = "SELECT * FROM testTable"

Any ideas would be appreacited, as I have been looking all over and cannot find anythign on this.
Thank You
 
This is what I did (similar thing)

sql = "select * from History where ridernumber=" & riderID
rsHist.Open sql, cn, adOpenKeyset, adLockReadOnly
listControlName.ListItems.Clear
Do While Not rsHist.EOF
' add the main ListItem object
Set li = listControlName.ListItems.Add(, , rsHist!Description & "")
' add all subsequent ListSubItem objects
li.ListSubItems.Add , , rsHist!brandabr & ""
li.ListSubItems.Add , , rsHist!comp & ""
li.ListSubItems.Add , , rsHist!bikesize & ""
li.ListSubItems.Add , , rsHist!classid
li.ListSubItems.Add , , rsHist!brandid
rsHist.MoveNext
Loop
rsHist.Close
Set rsHist = Nothing

HTH

AMACycleLoony
 
If you use a Listview control set to Report style then AMACycleLoony's code will work for you. Otherwise use the Listbox control from the Microsoft Forms 2 Object library which is in FM20.DLL

Note that FM20.DLL is not directly redistributable - do a search on the forum for more details

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top