Displaying criteria on a chart

S

Steve

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?
 
S

Steve

Ken,

Thanks so much for the response. I believe that your understanding of
programming in Access far exceeds mine. I am using hte sime [Enter Start
Date] and [Enter End Date] on the criteria field in the query. To keep it
simple for me, is there anyways to just have that information show up on the
report?
--
Steve


KenSheridan via AccessMonster.com said:
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?
 
S

Steve

Ken,

Your assistance has been most appreciated. I am going to work on trying
your way. I'm not sure how to set the parameters in a query to reference the
text boxes. I like my simple way, but it won't work because I am not
referencing the query as the record source of the report. I'm not doing that
because the chart on the report is using the query, and when I reference the
report to the query, it makes you enter the information twice (when it runs
the query when opening the report, and then again when running the chart).
--
Steve


KenSheridan via AccessMonster.com said:
Steve:

If the query is the report's RecordSource then you can simply reference the
parameters as the ControlSource properties of two unbound text boxes in the
report:

=[Enter Start Date]
and
=[Enter End Date]

or you could use a single text box with a ControlSource property along the
lines of:

="Between " & [Enter Start Date] & " and " & [Enter End Date]

but why not give the method using a form to enter the parameters a try. Its
not difficult, you simply create an unbound form, add the text boxes and a
button to open the report, which the button wizard can do for you. Then
change the parameters in the query to references to the text boxes in the way
I described. But if you stick with your simple parameters I'd still
recommend that you declare them in the query:

PARAMETERS
[Enter Start Date] DATETIME,
[Enter End Date] DATETIME;
SELECT…….

Ken Sheridan
Stafford, England
Ken,

Thanks so much for the response. I believe that your understanding of
programming in Access far exceeds mine. I am using hte sime [Enter Start
Date] and [Enter End Date] on the criteria field in the query. To keep it
simple for me, is there anyways to just have that information show up on the
report?
[quoted text clipped - 43 lines]
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?
 

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