5
Contributors
4
Replies
6
Views
9 Years
Discussion Span
Last Post by gdkons
0

attached the following code on form load event:

rec.MoveFirst
while not rec.EOF

combo1.addItem(rec.("Field Name"))
rec.moveNext
wend

0
Private Sub Form_Load()
Call con
'Fill The Combo box
While rs.EOF <> True
Combo1.AddItem rs!field
rs.MoveNext
DoEvents 'Add this code so that the system will not freeze...
Wend
Combo1.Enabled = False
End Sub
Public Sub con()

'Open The Connection
cn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb;Jet OLEDB:Database Password=;")

'Open The Recordset
rs.Open "SELECT * FROM Table1", cn, adOpenStatic, adLockOptimistic

End Sub
0

please find the following code
----------------------------------------
Dim rs as Recordset
Set rs = New Recordset
sSQL = "SELECT GroupNo FROM CenterMembers "
rs.Open sSQL, con, adOpenForwardOnly, adLockOptimistic
Combo1.clear
While Not rs.EOF
Combo1.AddItem rs!GroupNo
rs.MoveNext
Wend
rs.Close
--------------------------------------------
Note that con is connection object

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.