Start New Discussion within our Software Development Community

i am using VB with access. i need to load the values of a particular field in a table to a listbox .
i used the following coding in the Form_Load event.


Set db = New Connection
db.Open "PROVIDER=Microsoft.Jet.OLEDB.3.51;" & "data source= " & App.Path & "\test.mdb;"

Set rs = New Recordset
rs.Open "select name,model_no,product_master.capacity from product_master,com_evap where com_evap.model=product_master.model_no", db, adOpenDynamic, adLockOptimistic

List1.DataSource = rs

For i = 0 To rs.RecordCount - 1
List1.AddItem rs!Name

rs.MoveNext
Next i

but i throws an error telling "method not found",and points to "list1.datasource "
line.

then i removed that line and run the program . but then it didnt display anything in the list box.

can someone plz help me with this ?

i myself found the solution :)

i used the following coding

Set db = New Connection
db.Open "PROVIDER=Microsoft.Jet.OLEDB.3.51;" & "data source= " & App.Path & "\test.mdb;"

Set rs = New Recordset
rs.Open "select name,model_no,product_master.capacity from product_master,com_evap where com_evap.model=product_master.model_no", db, adOpenDynamic, adLockOptimistic


While rs.EOF = False
List1.AddItem rs!Name
rs.MoveNext

and its working ...:)

This question has already been answered. Start a new discussion instead.