Loading ADO Combo Box

What code is required to load an ADO combo box.  For example, with a regular combo box, this works:
 Do While adoPrimaryRS.EOF = False
  Combo1.AddItem adoPrimaryRS!ReportName
But this code cannot be used if the combo box is an ADO one.

Who is Participating?
Éric MoreauConnect With a Mentor Senior .Net ConsultantCommented:
When populating with the AddItem method, it doesn't matter if you use ADO compliant control or not.

If not bind, stick with the regular combo. You will be more confortable since you already know it!
Éric MoreauSenior .Net ConsultantCommented:
This control can only work in bound mode. You bind it at run-time this way:

Private Sub Form_Load()
    With DataCombo1
        Set .RowSource = DataEnvironment1.rsCommand1
        .ListField = "LastName"
    End With
End Sub

You can also bind it at design-time using the RowSource, RowMember and ListField property.

I just like to mention that «regular combo box» can be used if you would like to populate it with the AddItem method.
bhatchelAuthor Commented:
I was able to populate a regular combo box as you suggested, but was trying to be consistent with using ADO controls.
Éric MoreauSenior .Net ConsultantCommented:
Is it working?
bhatchelAuthor Commented:
I thought I responded before.  Your answer was exactly what I needed.  It's too bad Microsoft doesn't provide such complete examples.
All Courses

From novice to tech pro — start learning today.