Need Parameter Query to Read from Combo box

G

Guest

How can I make a parameter query read the parameter from a combo box?
Basically I want to have a drop down list and I want to pick a value. Then I
want to push a button next to it to run a report and use the value in the
drop down as the parameter.

Thanks in advance!
 
G

Guest

Hi

Let's say your report needs to be filtered by Sales Rep.
Your combo box is named cboChooseRep and your form is named MyForm.
Then the criteria in your query will have the following syntax...

[Forms]![frmMyForm]![cboChooseRep]

Note that the above will be equal to the bound column of the combo box which
is not necessarily what the combo box displays.

Eg in the above example I would expect the combo box to display a list of
sales rep's names but return the SalesRepID so my query would contain the
SalesRepID and the criteria for that colunm would be as above.

(See properties of the combo box - Format tab for Column Widths and Data tab
for Bound Column - these decide what is displayed and what value the combo
box takes)

hth

Andy Hull
 
K

Ken Snell \(MVP\)

This is a generic example of a query that reads a combo box from an open
form and uses it to filter the query's results:

SELECT *
FROM TableName
WHERE Fieldname = Forms!FormName!ComboBoxName;
 
G

Guest

Thanks. I will give it a try.

Andy Hull said:
Hi

Let's say your report needs to be filtered by Sales Rep.
Your combo box is named cboChooseRep and your form is named MyForm.
Then the criteria in your query will have the following syntax...

[Forms]![frmMyForm]![cboChooseRep]

Note that the above will be equal to the bound column of the combo box which
is not necessarily what the combo box displays.

Eg in the above example I would expect the combo box to display a list of
sales rep's names but return the SalesRepID so my query would contain the
SalesRepID and the criteria for that colunm would be as above.

(See properties of the combo box - Format tab for Column Widths and Data tab
for Bound Column - these decide what is displayed and what value the combo
box takes)

hth

Andy Hull


ShannaD said:
How can I make a parameter query read the parameter from a combo box?
Basically I want to have a drop down list and I want to pick a value. Then I
want to push a button next to it to run a report and use the value in the
drop down as the parameter.

Thanks in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top