Creating a sub report with variable number of fields to print

  • Thread starter Thread starter Michel Khennafi
  • Start date Start date
M

Michel Khennafi

Good morning

I would like to create a report that includes a subreport.

Situation:

- I have a Table T1
- I created a Xtab query 1 and a Xtab query 2 to extract informations from
the T1 table (sum of a field f1 by day of the week: Sun, Mon, Tue...)
- I created a selection query SQ1 that grabs all the data from Xtab queries
1 and 2 (sum of a field f2 by day of the week)
- Sub report is for data gathered in the selction query SQ1

My problem is that the number of fields returned by SQ1 may vary (1 week i
have totals for Mon thru Fri and another week I could have sums for Mon thru
Sun). I want to create a report that could handle all situations

I could I create a report that handles my problem?

Thanks for any guidance or help

MK
 
Open the crosstab query in design view.
Open the Properties box (View menu.)
Type the days of the week beside the Column Headings property, e.g.:
"Sun";"Mon";"Tue";"W...

You will now get 7 columns shown, even if a particular week does not have
data for all 7 days. Since all 7 columns turn up, you can build your
subreport with the 7 columns, and it won't fail.

More details:
Crosstab query techniques - row totals, zeros, parameters, column
headings
at:
http://allenbrowne.com/ser-67.html
 
It works perfectly thanks for the tip

MK
Allen Browne said:
Open the crosstab query in design view.
Open the Properties box (View menu.)
Type the days of the week beside the Column Headings property, e.g.:
"Sun";"Mon";"Tue";"W...

You will now get 7 columns shown, even if a particular week does not have
data for all 7 days. Since all 7 columns turn up, you can build your
subreport with the 7 columns, and it won't fail.

More details:
Crosstab query techniques - row totals, zeros, parameters, column
headings
at:
http://allenbrowne.com/ser-67.html
 
Back
Top