Don said:
I have a chart which pulls data based on a "Between" statement where I
enter the beginning date and the ending date. How can I get the dates I
enter to show on the graph? I know how to do this on a standard report
using a string in a text box but using this approach on a chart has not
worked. Can anyone assist me with this?
Thanks
Don,
I just went through this last week, changing label text on several
graphs in the same report.
They are placed in the Report Header section.
forms!frmDate!Text0 is the Parameter form and control used to enter the
date parameter. (The form is open when the report is run.)
All I needed was one date, so adapt it to 2 dates.
Add code to the Report's Report Header Format event:
Me!OLEUnbound0.ChartTitle.Text = "For the Year " & Forms!frmDate!Text0
Me!OLEUnbound0.Requery
Me!OLEUnbound7.Axes(2).HasTitle = True
Me!OLEUnbound7.Axes(2).AxisTitle.Text =
Format(DLookup("[BioArrivalAvg]", "qryBiomotionAvg"), "#.00") & "%"
Me!OLEUnbound7.Requery
It's the ChartTitle.Text you'll probably want to change, so just change
the above text to whatever you want.
I threw in the Axes(2).AxisTitle just to show you how to also change
that if you need to in the future. (Axis(2) is the Y axis).)
Of course, you will substitute your Control names in place of
OLEUnbound0 or OLEUnbound7.
As an alternative to changing the actual chart label, you could have
just added a regular Access text control on top of the graph and set
it's control source to:
= "Between " & forms!frmDate!Beginning Date & " and " &
forms!frmDate!Ending Date
Set it to "Bring to Front" so it shows on top of the graph.
It will work just as well as the chart label change above.