How to create a report with run-time parameters?

  • Thread starter Thread starter Joe
  • Start date Start date
J

Joe

Hello,

I'm totally new to Access and have to create a report
where a user can select a city from a drop-down menu/combo-
box and get a list of people from the selected city.

I know how to create simple reports, and have done
something similar (displaying records based on data
selected in a drop-down menu) in forms, but have no idea
how to do this in a report.

I'll appreciate detailed steps if you do respond.

TIA.

Joe.
 
Hello,

I'm totally new to Access and have to create a report
where a user can select a city from a drop-down menu/combo-
box and get a list of people from the selected city.

I know how to create simple reports, and have done
something similar (displaying records based on data
selected in a drop-down menu) in forms, but have no idea
how to do this in a report.

I'll appreciate detailed steps if you do respond.

TIA.

Joe.

Joe,

Create an unbound form.
Add a combo box.
Set the Row Source of the combo box to include the
CityID field and the CityName, and best to also include the State, as
there are many cities with the same name in different states.
Name the Combo Box 'FindCity'.
Set it's Bound column to 1.
Set it's Column Count to 3 (if you include the State).
Set the Column Width property to 0";1";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 Query Record Source [CityID] field criteria line,
write:
forms!ParamForm!FindCity

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 City.
Click the command button and then report will run.
When the report closes, it will close the form.
 
Fred,

Thanks much for the prompt response. That worked!

Joe
-----Original Message-----
Hello,

I'm totally new to Access and have to create a report
where a user can select a city from a drop-down menu/combo-
box and get a list of people from the selected city.

I know how to create simple reports, and have done
something similar (displaying records based on data
selected in a drop-down menu) in forms, but have no idea
how to do this in a report.

I'll appreciate detailed steps if you do respond.

TIA.

Joe.

Joe,

Create an unbound form.
Add a combo box.
Set the Row Source of the combo box to include the
CityID field and the CityName, and best to also include the State, as
there are many cities with the same name in different states.
Name the Combo Box 'FindCity'.
Set it's Bound column to 1.
Set it's Column Count to 3 (if you include the State).
Set the Column Width property to 0";1";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 Query Record Source [CityID] field criteria line,
write:
forms!ParamForm!FindCity

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 City.
Click the command button and then report will run.
When the report closes, it will close the form.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal email
.
 
Back
Top