Does anyone know how to define the Column Headings property in a crosstab query with VBA in Access 2000? The code would need to change the column headings everytime a report is run so the included headings are only those that have data, according to the criteria that is set at the time.
I have a report set up which includes two sub-reports, one showing contract budgets for different cities, and one showing contract expenses for each city. The main report then gives a balance remaining for each city and in total.
The sub-reports show each city as a column heading. The cities on each contract vary, and there are possibly 20 or more to select from. I have been trying to change it to show the budget and expenses in crosstab format, with dynamic headings, like the following example:
Contract Name
Contract Number
--------------
Subreport 1
Budgets:
City 1 City 2 City 3 Total
Date 1 Description $$$$$ $$$$$ $$$$$ $$$$$
Date 2 Description $$$$$ $$$$$ $$$$$ $$$$$
----- ----- ----- -----
Totals $$$$$ $$$$$ $$$$$ $$$$$
---------------
Subreport 2
Expenses:
City 1 City 2 City 3 Total
Date 1 Description $$$$$ $$$$$ $$$$$ $$$$$
Date 2 Description $$$$$ $$$$$ $$$$$ $$$$$
----- ----- ----- -----
Totals $$$$$ $$$$$ $$$$$ $$$$$
----------------
City 1 City 2 City 3 Total
Balance $$$$$ $$$$$ $$$$$ $$$$$
When I run the report, it says "You can't use a pass-through query or a non-fixed-column crosstab query as a record source for a subform or subreport. Before you bind the subform or subreport to a crosstab query, set the query's ColumnHeadings property."
I am wondering if there is anyway to feed column headings to the crosstab query through code, and if this might solve the problem. I have too many cities to set the ColumnHeadings property manually. The headings need to be dynamic.
I have downloaded the Solutions database for Access 2000 from the Microsoft website, and have used it to set up this report. However, it doesn't seem to address this issue.
Any help is much appreciated.
Thanks!![[ponytails] [ponytails] [ponytails]](/data/assets/smilies/ponytails.gif)
I have a report set up which includes two sub-reports, one showing contract budgets for different cities, and one showing contract expenses for each city. The main report then gives a balance remaining for each city and in total.
The sub-reports show each city as a column heading. The cities on each contract vary, and there are possibly 20 or more to select from. I have been trying to change it to show the budget and expenses in crosstab format, with dynamic headings, like the following example:
Contract Name
Contract Number
--------------
Subreport 1
Budgets:
City 1 City 2 City 3 Total
Date 1 Description $$$$$ $$$$$ $$$$$ $$$$$
Date 2 Description $$$$$ $$$$$ $$$$$ $$$$$
----- ----- ----- -----
Totals $$$$$ $$$$$ $$$$$ $$$$$
---------------
Subreport 2
Expenses:
City 1 City 2 City 3 Total
Date 1 Description $$$$$ $$$$$ $$$$$ $$$$$
Date 2 Description $$$$$ $$$$$ $$$$$ $$$$$
----- ----- ----- -----
Totals $$$$$ $$$$$ $$$$$ $$$$$
----------------
City 1 City 2 City 3 Total
Balance $$$$$ $$$$$ $$$$$ $$$$$
When I run the report, it says "You can't use a pass-through query or a non-fixed-column crosstab query as a record source for a subform or subreport. Before you bind the subform or subreport to a crosstab query, set the query's ColumnHeadings property."
I am wondering if there is anyway to feed column headings to the crosstab query through code, and if this might solve the problem. I have too many cities to set the ColumnHeadings property manually. The headings need to be dynamic.
I have downloaded the Solutions database for Access 2000 from the Microsoft website, and have used it to set up this report. However, it doesn't seem to address this issue.
Any help is much appreciated.
Thanks!
![[ponytails] [ponytails] [ponytails]](/data/assets/smilies/ponytails.gif)