I have connected combo box to database and the first content of the column is displayed.. I want to display all the contents of the column in combo box .. How can i do that ?
combo box...
Collapse
X
-
-
Originally posted by debasisdaspost the code how you have connected to database.
Option Explicit
Dim c As New ADODB.Connectio n
Dim cm As ADODB.Command
Dim rs As New ADODB.Recordset
Private Sub Form_Load()
Dim cs As String
c.Open ("Provider=Micr osoft.Jet.OLEDB .4.0;Data Source=d:/_______.mdb;Per sist Security Info=false")
rs.Open "select * from _______", c, adOpenDynamic
Me.Combo1.Text = rs(2)
Do Until rs.EOF = True
rs.MoveNext
Loop
End SubComment
-
Originally posted by QVeen72Hi,
You need to add the Items in Loop..
[code=vb]
rs.Open "select * from _______", c, adOpenDynamic
Do Until rs.EOF = True
Me.Combo1AddIte m rs(2)
rs.MoveNext
Loop
[/code]
Regards
Veena
Hi
Me.Combo1. AddItem rs(2) now its working .. tksComment
-
Hi,
After connecting your database use this code.
[CODE=vb]REC.MoveFirst
Do While Not REC.EOF
Combo1.Additem (REC.Fields(0))
REC.MoveNext
loop[/CODE]
Regards
>> ALI <<Comment
Comment