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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

É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:
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!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
É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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.