I'm not sure I follow. When I set this up, I used the instructions below
from another post...
Try not to use "absolute" column headings for dates. You could possibly use
"relative" dates. For instance:
Form: frmA
Text Box: txtEndDate
Table: tblSales
Field: SaleDate
You want to show 12 months of sales in columns of a crosstab report.
Set the with menuing: Query|Parameter
Forms!frmA!txtEndDate Date/Time
Use this expression for your Column Headings:
ColHead:"Mth" & DateDiff("m",[SaleDate],Forms!frmA!txtEndDate)
This will produce Mth0, Mth1, Mth2, Mth3,... where Mth0 is sales from the
same month as the ending date on your form. Mth1 is the previous month etc.
Set your queries Column Headings property to:
"Mth0", "Mth1", "Mth2", "Mth3",.., "Mth11"
Build your report based on these "relative" months. If you need column
labels in your report, use text boxes with control sources of:
=DateAdd("m",0,Forms!frmA!txtEndDate)
=DateAdd("m",-1,Forms!frmA!txtEndDate)
=DateAdd("m",-2,Forms!frmA!txtEndDate)
=DateAdd("m",-3,Forms!frmA!txtEndDate)
...
This solution requires no code and will run fairly quickly.
--
Duane Hookom
MS Access MVP
Sorry to be so dense, but do you have any other suggestions?
--
Leslie M
KARL DEWEY said:
You need to use the fields from the query.
--
KARL DEWEY
Build a little - Test a little
:
Karl,
Thanks for your reply. When the form is open I get a runtime error - "You
entered an expression that has no value." I worked on this all day of
Friday, and can't for the life of me figure out what I'm doing wrong.
--
Leslie M
:
The form must be open and you will need data in it.
--
KARL DEWEY
Build a little - Test a little
:
I have a report based on a crosstab query which uses a form to specify date
parameters. Per Duane Hookum's recommendations on other posts I set up the
query so that the column headers display relative dates - Mth0, Mth1, etc.
However when I attempt to use the DateAdd fuction to add relative month
labels to my report, I consistently get a #Name? error.
Text Box Control Source: =DateAdd("m",0,[Forms]![frmMLUsage]![TrendStartDate])
Form: frmMLUsage
Form Text Box: TrendStartDate
Can anyone help me figure out why I keep getting this error?
Thank you.