select from a combo box to display a report

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

Guest

I have a report that uses a query that takes a parameter. I want to be able
to select the parameter from the combo box, and the report will run based on
the query. How can I do this?
 
I have a report that uses a query that takes a parameter. I want to be able
to select the parameter from the combo box, and the report will run based on
the query. How can I do this?

Change the control names below as needed.

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 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.
 
Akilah said:
I have a report that uses a query that takes a parameter. I want to be able
to select the parameter from the combo box, and the report will run based on
the query. How can I do this?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In the SQL view of the query enter a PARAMETER line similar to this:

PARAMETERS Forms!FormName!ComboBoxName Long;

Use a WHERE clause similar to this:

WHERE column_name = Forms!FormName!ComboBoxName

Change the names and data types as needed.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBRAS0SoechKqOuFEgEQL9eQCdE0lv09C8MBvxY+LrJfCHymPs09QAn3Fo
O2XG9g5zmZ42+mFhtJuQDjz1
=d5Z9
-----END PGP SIGNATURE-----
 
I tried this method and my report just came up blank. I think I must be
missing a step. Can you please tell me each step.

fredg said:
I have a report that uses a query that takes a parameter. I want to be able
to select the parameter from the combo box, and the report will run based on
the query. How can I do this?

Change the control names below as needed.

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 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.
 
I tried this method and my report just came up blank. I think I must be
missing a step. Can you please tell me each step.

fredg said:
I have a report that uses a query that takes a parameter. I want to be able
to select the parameter from the combo box, and the report will run based on
the query. How can I do this?

Change the control names below as needed.

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 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.

I did tell you each step...
Did you change [CompanyID] to whatever the actual name is of the field
you are using as criteria?

You'll need to tell me what you did, as I can't see your database.
 
I figured it out, my button's names wasn't matching the function name.
Thanks for the help.

fredg said:
I tried this method and my report just came up blank. I think I must be
missing a step. Can you please tell me each step.

fredg said:
On Tue, 28 Feb 2006 11:36:24 -0800, Akilah wrote:

I have a report that uses a query that takes a parameter. I want to be able
to select the parameter from the combo box, and the report will run based on
the query. How can I do this?

Change the control names below as needed.

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 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.

I did tell you each step...
Did you change [CompanyID] to whatever the actual name is of the field
you are using as criteria?

You'll need to tell me what you did, as I can't see your database.
 
Back
Top