please help that how to add data of one field of database to the combo box.

i attached one rar file with this. check that

hi pranavdv...
where is your attachment?
Rar file is not supported in this forum, use zip file.

try this code :

Private Sub Form_Load()
Dim RS As ADODB.Recordset
    Dim Conn As ADODB.Connection
    Dim Comm As ADODB.Command
    Dim str As String
    
    Set Conn = New ADODB.Connection
    Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = D:\Only Me\Authors.mdb"
    Conn.Open
    Set Comm = New ADODB.Command
    Set Comm.ActiveConnection = Conn
    Comm.CommandText = "SELECT Au_ID FROM Authors"
    Comm.CommandType = adCmdText
    Set RS = Comm.Execute
    
    Do Until RS.EOF = True
        Combo1.AddItem RS!Au_ID
    RS.MoveNext
    Loop
     
    Set RS = Nothing
    Set Comm = Nothing
    Set Conn = Nothing
End Sub

Thanks JX_MAN, I will take that as a compliment. I wonder how many of those solved threads of yours are down to blatantly copying other members replies.
Whereas copying obviously works for some , others benefit from doing a little bit of thinking themselves!!
Hope the code helps with your problem Pranavdv.
Getting to grips with the ADO control is hard work but is a great tool once you get rolling.
Cheers for now

??
hmm...sorry if this code some like yours...
well, i have a book for this.

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.