Use a form to enter report Criteria

  • Thread starter Thread starter bill
  • Start date Start date
B

bill

I followed the direction in the help screen of Access
for "Use a form to enter report criteria" I am trying to
do beginning and ending date. the report works, the
parameter dialog box comes up with a text box for
beginning date and one for ending date. the OK and the
CANCEL button work as they should. When I enter the dates
and click OK the report runs but it doesn't pay any
attention to the date parameters set.
The instructions didn't say anything about setting the
RecordSource in the properties of the text boxes on the
parameter dialog box? Could that be the problem?
Any suggestions on what to look for?
 
I have no idea how you went about opening the form
to enter the date parameters, so 'I'll start afresh.

Make your report, using the query as it's recordsource.
Code the Report's Open event:
DoCmd.OpenForm "frmParam", , , , , acDialog

Code the Report's Close event:
DoCmd.Close acForm, "frmParam".

Make a new unbound form to enter the parameter dates in.
Add 2 unbound controls to the form.
Name one "StartDate".
Name the other "EndDate".
Set their Format property to any Date format.
Add a Command Button to the Form.
Code it's Click event:
Me.Visible = False
Name this form "frmParam".

Open the query in design view.
Set the Criteria for the Date field to:
Between forms!frmParam!StartDate AND forms!frmParam!EndDate

Save the changes.

Run the Report.
The parameter form will open.
Enter the start and end dates.
Click the command button.

The report will display the records within those entered dates.
You will NOT see a parameter box come up, nor will you see the query.

When the Report closes it will also close the parameter form.
 
Let me ge this right. You have a form with 2 fields. You enter dates into
these fields. There is also an OK button. When you click the OK button, a
report opens where the date is between the 2 dates you entered on the form.
Is that correct? If the report is based on a query then put the following
into the criteria under the date column in the query.

Between Forms!frmParam!txtStart and Forms!frmParam!txtEnd

Where frmParam is the name of your form where you are entering the dates and
txtStart and txtEnd are the names of the 2 boxes on the form.

Kelvin
 
Back
Top