Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21256

cannot populate combo box with access 2003

$
0
0
i tried to populate combobox with access it show me blank data on combo box.

Code:

Private Sub Comboyear_Change()

Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim str As String
Dim i As Integer

con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Test.mdb;Jet OLEDB:Database Password=123"

str = "select year from test"
rs.Open str, con, adOpenStatic, adLockOptimistic

i = 0

While Not rs.EOF
Comboyear.List(i) = rs.Fields(0)
rs.MoveNext
i = i + 1
Wend

rs.Close
con.Close
Set rs = Nothing
Set con = Nothing

End Sub


Viewing all articles
Browse latest Browse all 21256

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>