Crosstab query column headings

G

Guest

Is there any way to specify the column heading names in a crosstab query.
Here's my issue. I'm building a report that bases off a crosstab query. Of
course the crosstab query headers are named the pivot values. However, the
query is looking at trends and the column headers will change. For example,
I have a query give me a trend over the past 3 months, pivoted on the month -
so I get column headings Feb, Mar, April. If I run the same query next
month, I'll get colum headings Mar, April, May. I'd like to just name them
Month1, Month2, Month3. The access report that is based on the query has to
have the control source specified, but it's a column header that is
constantly changing. Any help? I believe my only two options are to figure
out how to make the query heading static (Month1, etc) or make the control
source in my report look for a specific column number (query.column(2) -
??this doesn't seem to work) and not a column name 'Jan'.

Thanks!
 
D

Duane Hookom

Assuming you want a three month period that ends on the date value in the
control Forms!frmDates!txtEndDate:
Use a column heading expression of:
ColHead: "Mth" & DateDiff("m", [DateField],Forms!frmDates!txtEndDate)
Set the Column Headings property to Mth0, Mth1,Mth2 for three months up to
and including the date on the form.

You may also need to set the data type of your query pararmeter. Select
Query->Parameters and enter
Forms!frmDates!txtEndDate Date/Time
 

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