Help Please

  • Thread starter Thread starter Gary Nelson
  • Start date Start date
G

Gary Nelson

In Access 2000, I am trying to have the user enter a start date and an end
date when they push a command button on a form. A report will display the
data between the start date and end date specified. Can someone please tell
me how this is done.

I have the view created and the report off of the view. Your help is
appreciated.

Thanks in advance
 
The very simplest way I think is to create the report
based on a query.
In the query specify ">=[Enter Start Date]" in the
criteria block for the start date data element. Likewise,
specify "<=[Enter End Date]" in the criteria block for the
End date data element .
Now when you run the report either for print or for
preview you will be prompted to enter the dates.
Hope this helps.
Fons
 
Gary,
Create an unbound form. Add 2 Text Controls.
Name one StartDate and the 2nd EndDate.

Add a command button.
Code the button's click event:

Me.Visible = False

Name this form 'ParamForm'.

Make a query which will be used as your Reports Record Source.
In the query Date field's criteria line, write:
Between forms!ParamForm!StartDate AND forms!ParamForm!EndDate

Change your report's current record source to this query.
Next, code the main report's Open event:
DoCmd.OpenForm "ParamForm", , , , , acDialog

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

When ready to run the report, open the report. The form will display
and wait for the entry of the dates. Click the command button and the
report will run without need for any further parameter entries. When
the report closes, it will close the form.

If, in addition to the above, you wish to show the criteria dates on the
report,
add an unbound control to the Report Header.
Set it's Control source to something like:
="For Sales between " & forms!ParamForm!StartDate & " and " &
forms!ParamForm!EndDate
 
Back
Top