Loading ADO Combo Box

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

bhatchelAsked:
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()
    DataEnvironment1.rsCommand1.Open
    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.
0
bhatchelAuthor Commented:
Thanks,
I was able to populate a regular combo box as you suggested, but was trying to be consistent with using ADO controls.
0
É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!
0

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?
0
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.
0
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.