Use relative columns in your query based on a date entered by a user in Forms!frmDates!txtEnd. Your query would look like:
Parameters [Forms]![frmDates]![txtEnd] DateTime;
TRANSFORM Count([Staffing Query].Title) AS CountOfTitle
SELECT [Staffing Query].ERName, [Staffing Query].Department, Count([Staffing Query].Department) AS [Total Of Department]
FROM [Staffing Query]
GROUP BY [Staffing Query].ERName, [Staffing Query].Department
PIVOT "d" & DateDiff("d",Forms!frmDates!txtEnd,[Date Scheduled]) IN ("d0", "d1", "d2", etc , "d27");
The Column Headings property would have the values:
"d0", "d1", "d2", etc , "d27"
The column with a heading of d0 will be the values from the date on the form. d27 will be 27 days earlier.
Then in the report use text boxes for the column labels. Set the control sources to:
=DateAdd("d",0,Forms!frmDates!txtEnd)
=DateAdd("d",-1,Forms!frmDates!txtEnd)
=DateAdd("d",-2,Forms!frmDates!txtEnd)
...
=DateAdd("d",-27,Forms!frmDates!txtEnd)
Duane
MS Access MVP
Find out how to get great answers faq219-2884.