Steve:
You can include unbound text box's in the report which reference the
parameters. Rather than using simple parameters such as [Enter start date:]
and [Enter end date:] I'd recommend opening the report from a dialogue form
with two text boxes and reference these as the parameters, e.g.
Forms!YourForm!txtStartDate
and
Forms!YourForm!txtEndDate
This also has the advantage that you can include validation code in the form,
to ensure for instance that both dates have been entered and that the end
date is not earlier than the start date.
Provided the form remains open you can then confidently reference them from
anywhere, so the ControlSource properties of the text boxes would be:
=Forms!YourForm!txtStartDate
and
=Forms!YourForm!txtEndDate
You can close the form in the report's Close event procedure if you want it
to automatically close when finished with:
DoCmd.Close acForm, "YourForm"
BTW one thing which is always advisable, particularly with date/time
parameters, is to declare them in the query. You can do this in design view
or simply by adding the declaration to the start of the query in SQL view:
PARAMETERS
Forms!YourForm!txtStartDate DATETIME,
Forms!YourForm!txtEndDate DATETIME;
SELECT…….
Otherwise there is the risk that a date entered in short date format could be
interpreted as an arithmetical expression rather than a date value.
Ken Sheridan
Stafford, England
Hi group,
I have a report that is creating a chart from a query. In the query, I am
requiring the user to input the starting and ending date. Does anyone know
if there is a way to display that starting and ending date on the chart?