Query result sent to combo box control.

  • Thread starter Thread starter Joe R.
  • Start date Start date
J

Joe R.

I have created a form that allows a user to select a
button which will run a query. I would like the query
results however, to be displayed as selectable items
within a combo box.

I know how to use a combo box to run a query as the form
is open. In my example however, I need the user to be
able to be able to select a different query and thus
results to be posted into the original combo box.

Any and all help would be much appreceated.

Best,
Joe.
 
Set the combobox's Row Source to the new query.

Me.cboMyComboBox.RowSource = "SELECT....;"

If it doesn't autorequery when you do this then force a requery.

Me.cboMyComboBox.Requery
 
You just need to change the RowSource property of the combo box to the name
of the query (or SQL). In the code for the button put:

Me.NameOfComboBox.RowSource = "NameOfQuery"

This will work provided the number of columns set for the combobox matches
the number of columns returned by the query.
 
Back
Top