Selecting query criteria via a pull down list

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a query that I want to prompt me for an input, however I want to be
able to select the criteria from a pull down list instead of typing it in. is
this possible?
 
You could use a form that has your ComboBox control with the values that you
want. In the query reference the ComboBox value as part of the criteria for
the query for the field you are restricting. (=[Forms]![formName]!
[comboBoxName])
 
I have a query that I want to prompt me for an input, however I want to be
able to select the criteria from a pull down list instead of typing it in. is
this possible?

Yes, using a form.
Is the query the end of the process, or is the query to be the record
source of a report?
 
This is only showing up as a prompt to type in the criteria not a pull down
list.

djbiehl said:
You could use a form that has your ComboBox control with the values that you
want. In the query reference the ComboBox value as part of the criteria for
the query for the field you are restricting. (=[Forms]![formName]!
[comboBoxName])
I have a query that I want to prompt me for an input, however I want to be
able to select the criteria from a pull down list instead of typing it in. is
this possible?
 
Fredg, The query will ultimately be used for reporting purposes.

You'll need to use a form to do this.

Let's assume it is a CustomerID number you need as criteria.

Make a new unbound form.
Add a combo box that will show the CustomerID field.
Make sure the Combo Box Bound Column is the
CustomerID field.
Add a command button to the form.
Code the button's Click event:
Me.Visible = False
Name this form "ParamForm"

Code the Report's Record Source Query's CustomerID field criteria
line:
forms!ParamForm!ComboBoxName

Code the Report's Open Event:
DoCmd.OpenForm "ParamForm" , , , , , acDialog

Code the Report's Close event:
DoCmd.Close acForm, "ParamForm"

Run the Report.
The report will open the form.

Find the CustomerID in the combo box.
Click the command button.

The Report will display just those records selected.
When the Report closes it will close the form.
 
Sweet, that did it, now I just need to get my query results correct and
everything will be peachy. Thank you for the help.
 
Back
Top