i am trying to load data from the database to a dbcombo
but i am not getting it properly

i am using the following coding :

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

Set rs = New Recordset
rs.Open " select model_no from Product_master", db, adOpenStatic, adLockReadOnly

Set DB_type.DataSource = rs

DB_type.BoundColumn = "model_no"
DB_type.DataField = "model_no"
DB_type.ListField = rs.Fields(1)

what's wrong in this code ? plz help

Please specify what is the error message ?

Which line is throwing the error ?

You can use normal combobox .Try like this

Dim SQLName As String
CboName.Clear
SQLName = "SELECT NAME FROM ENGINEER"
Rs.Open SQLName, Con, adOpenDynamic, adLockOptimistic

Set CboName.DataSource = Rs
For i = 0 To Rs.RecordCount - 1
CboName.AddItem Rs(0)
Rs.MoveNext
Next i
Rs.Close

Please specify what is the error message ?

Which line is throwing the error ?

thank you for your reply .. actually when i run the application, it says "item cannot be found in the collection coresponding to the requested name or ordinal "

and when i debug , its pointing to the following line :
DB_type.ListField = rs.Fields(1)

Anyway i got what i required from your reply
thanks very much :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.