Populate Access Combo Box from SQL Query

I'm trying to do the following:

Enter your name
Enter you password
[submit]

After submission with button and authentication, populate the appropriate data based off a query on the person's name into a combo box. Any thoughts on how to do this?  I'm writing the function/macros with VB through Access.

I'll usually do something like this:

Dim rselect As New ADODB.Recordset
' open connection stuff here
rselect.Open "select data where name = name", cnn, adOpenStatic, adLockOptimistic

Can I push this rselect set into the combo box or is there a better way to do it?

Ant_DoggAsked:
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.

peter57rCommented:
Can you clarify what you are using for your forms and  code.

Are you writing a VB front-end with an Access backend or do you mean you are writing vba code in an Access front-end (also with an Access backend)
0
Ant_DoggAuthor Commented:
It's Access forms with a SQL server backend.  The behavior of all my buttons are controlled with VB code through Access, such as connection, submissions, and updates to the database.

I want this button to query the SQL database, return a recordset (1 column) and populate it to a combo box.
0
peter57rCommented:
You just set the rowsource of the combo to the sql string that you are currently using for your recordset.
Forms!formname!comboname.rowsource = strSQL

I'm assuming your real sql is correctly structured, as the code you posted is not.
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
Ant_DoggAuthor Commented:
Thats what I was looking for, thanks!
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
Microsoft Access

From novice to tech pro — start learning today.