How to specify criteria in a query for a report?

G

Guest

I saw an explanation of this somewhere but can not find it the second time.
If I want to run a query, for a report, on a certain client how can I get the
dialog box to popup to allow me to enter in the clients name?
I could create individual queries and reports for each client but this could
mean many many separate reports to create.

Thanks
Barry
 
F

fredg

I saw an explanation of this somewhere but can not find it the second time.
If I want to run a query, for a report, on a certain client how can I get the
dialog box to popup to allow me to enter in the clients name?
I could create individual queries and reports for each client but this could
mean many many separate reports to create.

Thanks
Barry

Create an unbound form.
Add a combo box.
Set the Row Source of the combo box to include the
CompanyID field and the Company Name.
Name the Combo Box 'FindCompany'.
Set it's Bound column to 1.
Set it's Column Count property to 2.
Set the Column Width property to 0";1"

Add a Command Button to the form.
Code the button's click event:

Me.Visible = False

Name this form 'ParamForm'.

In the Report's Record Source [CompanyID] field criteria line write:
forms!ParamForm!FindCompany

Next, code the report's Open event:
DoCmd.OpenForm "ParamForm", , , , , acDialog

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

When ready to run the report, open the report.
The form will open and wait for the selection of the Company
Click the command button and then report will run.
When the report closes, it will close the form.
 
G

Guest

With the database open, press the F1 key. In the dialog box type in
Parameter. Select "Create and use a parameter query" and keep drilling down
with MDB until Help finally coughs up some good info.
 

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