Using a form to run a report?

  • Thread starter Mikael Lindqvist
  • Start date
M

Mikael Lindqvist

Hi,

Looked low and high for a basic tutorial on how to make use a form to enter
some "field criterias" and from there run a report.

That is, I have already created a report that uses an underlying query, and
now I would like to make a form that change some of the queries field
criterias and then run the report (using the changed criterias).

But I need a kick-start, so any help much appreciated!

Kindly,
Mikael
 
F

fredg

Hi,

Looked low and high for a basic tutorial on how to make use a form to enter
some "field criterias" and from there run a report.

That is, I have already created a report that uses an underlying query, and
now I would like to make a form that change some of the queries field
criterias and then run the report (using the changed criterias).

But I need a kick-start, so any help much appreciated!

Kindly,
Mikael

The below method assumes you want a combo box to select a company to
report on, and a start and end date to further filter the report.
Adapt the 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 it's Column Count property to 2.
Set the Column Width property to 0";1"

Also add 2 unbound text controls.
Set their format to a valid date format.
Name them "StartDate" and "EndDate"

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 (the query) [CompanyID] field criteria
line write:
forms!ParamForm!FindCompany

As criteria in the query date field write:
Between forms!Paramform!StartDate and forms!ParamForm!EndDate

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 and the
entry of the starting and ending dates wanted.
Click the command button and then report will run.
When the report closes, it will close the form.
 

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