Question Locked

Link combobox with access table using VB 6

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi,

I am trying to connect combobox with access table to call some data on combobox below is the code which i have used but there is some problem with the code.
can any plz help me where i am going wrong

Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cn.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;data source=" & App.Path & "\contract_management.mdb"
cn.Open
cn.CursorLocation = adUseClient
rs.Open "select client_name from masterdata", cn, adOpenDynamic, adLockOptimistic

With rs
While rs.EOF
Combo1.AddItem
.MoveNext
Wend
End With

2 replies

by tony hopkinson

but Combo1.additem(rs.Fields["Client_Name"])

or some such might work better.

PS

Give Combo1 a meaningful name, and ditch the with statement.

This discussion is closed to new replies.