Dynamic subreport within report

  • Thread starter Thread starter Anisah
  • Start date Start date
A

Anisah

My problem (in Access 2002) : I have a report based on a
query, this report print one page per person (sort of ID,
so if there is 40 people in the query, there are 40 pages
printed). This report contains a subreport, which is based
on another query (linked by person's ID) of up to 6
additional records. This query contains references to some
informations regarding the person.

Problem : the subreport needs to act differently
(show/hide some fields) depending on the information
within these 6 additional records. I can perform the
same "calculation" in a form using a function button that
recalculates when clicked, so I have logic for the
calculations correct. And performing the logic "on open"
of the report only calculates the information once, and
displays it the same for each person. What I can't figure
out is getting this to occur for each person/page in the
report.

Questions : I've already linked the subreport query to the
main report based on the person's ID, but how do I get the
calculation to be performed for each person if there are
40 people in the entire report?

Any suggestions would be *greatly* appreciated!
Thanks in advance,
- Anisah
 
Anisah said:
My problem (in Access 2002) : I have a report based on a
query, this report print one page per person (sort of ID,
so if there is 40 people in the query, there are 40 pages
printed). This report contains a subreport, which is based
on another query (linked by person's ID) of up to 6
additional records. This query contains references to some
informations regarding the person.

Problem : the subreport needs to act differently
(show/hide some fields) depending on the information
within these 6 additional records. I can perform the
same "calculation" in a form using a function button that
recalculates when clicked, so I have logic for the
calculations correct. And performing the logic "on open"
of the report only calculates the information once, and
displays it the same for each person. What I can't figure
out is getting this to occur for each person/page in the
report.

Questions : I've already linked the subreport query to the
main report based on the person's ID, but how do I get the
calculation to be performed for each person if there are
40 people in the entire report?


Depends on what the calculations are based on. If it's
based on the person ID value, then you can do the
calculation in the Format event of the Report Header or
Detail sections. If its based on values in each record, the
you must do it in the Detail's Format event.

If the subreport's Report Footer section is dupposed to have
some kind of totals of all the detail, then you should not
use a detail event procedure. Use either a RunningSum text
box in the detail section or, if possible, use the aggregate
functions (Count, Sum, etc).
 
I'm sorry, I don't quite understand how to get the logic
performed... let be me more specific about what I'm trying
to do. I need to cycle through the 6 records in the
subform and investigate the values in field x. Depending
on the values of field x, I need to display up to four
values retrieved from field x. Like I said, I already
have the logic from another place, but what event do I put
the logic under to make sure it's performed everytime the
report is run, for each page?

Thanks in advance,
- Anisah
 
Anisah said:
I'm sorry, I don't quite understand how to get the logic
performed... let be me more specific about what I'm trying
to do. I need to cycle through the 6 records in the
subform and investigate the values in field x. Depending
on the values of field x, I need to display up to four
values retrieved from field x. Like I said, I already
have the logic from another place, but what event do I put
the logic under to make sure it's performed everytime the
report is run, for each page?

I'm afraid you'll need to be a lot more specific than that.

What do you mean by "investigate the values in field x"?

How does "Depending on the values of field x" affect the
result?

What are the and how should the "up to four values retrieved
from field x" be displayed?

I'm getting the impression that you're hoping for a magic
incantation that allows you to treat all the records in a
subreport as if they were in an array, if so, and lacking
the specifics, I think you might have to forget that idea.
Again, depending on the specifics, you should look towards
using an aggregate function in the subreport's footer or
maybe even another subreport based on a query that
calculates whatever you're looking for.



 
Back
Top