How to populate a ComboBox with a Recordset using VBA

前端 未结 6 796
星月不相逢
星月不相逢 2021-02-15 13:34

There is some literature available at expert\'s exchange and at teck republic about using the combobox.recordset property to populate a combobox in an Access form.

The

6条回答
  •  故里飘歌
    2021-02-15 14:13

    In MS Access, it's ok, but in VB, you may use something like this using adodc (Jet 4.0):

    Private sub Form1_Load()
       with Adodc1
         .commandtype = adcmdtext
         .recordsource = "Select * from courses"
         .refresh
    
         while not .recordset.eof
               combo1.additem = .recordset.coursecode
               .recordset.movenext
         wend
       end with
    End Sub
    

提交回复
热议问题