How can I ask the subreport to print X times?
Hi,
I have a main report with no data pipline, and there is a subreport in the
detail band,
1) How can I make the subreport to print X number of times?
2) Where should I put the code to update the count by one, and pass it to
the subreport so the subreport can re-excute the query with the new count.
Thanks
William
I have a main report with no data pipline, and there is a subreport in the
detail band,
1) How can I make the subreport to print X number of times?
2) Where should I put the code to update the count by one, and pass it to
the subreport so the subreport can re-excute the query with the new count.
Thanks
William
This discussion has been closed.
Comments
band to print more than once per record. This is what you'll have to do, so
that te subreport is generated multiple times because its parent detail band
is reprinting. There is another way. Where you have the subreport now, place
a new subreport and drop the original subreport inside of it. Then set the
new subreport's DetailBand.BandsPerRecord property to X. This way you can
use this driver subreport that only has the real subreport in it to print X
times.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
What does exactly the BandsPerRecord property do? Does it just simply
re-print the same record X times? the one I really want is that the most
inner subreport should be re-execute the query to get the new records base
on the new printing count. Could it be done?
William
using the same record position. It won't refire the query.
If the query is parameterized, you can use the DetailBand.BeforePrint event
to set the new parameter on the detail query for the subreport. Then the
detail will reprint and the subreport will reprint because its parent detail
band is reprinting.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
How to make this kind of subreport to print start at a new page each
time?
William
control of the page and it always starts on a new page with its own header
and footer.
The alternative is to use a group in the main report based on the key
linking field and set the group to be StartOnNewPage.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
I just get confused, if I have the subreport1(it is in the detail band of
main report), it has the subreport2 in the its detail band, in order to
reprint subreport2 X times, which detailband.BandsPerRecord should be set to
X times, according what you told me:
1)I should set the subreport2's detail.BandsPerRecord set to X, but what if
the subreport2's detail is in a group? Does the reprinting subreport2 X
times still work?
2) Which event in which subpreport should I use to put the following code:
detail.BandsPerRecord := X;
3) In which detailband.BeforePrint event, I should set a new parameter so
the subreport2 can get the new query, I suppose it should
Subreport1.detail.BeforePrint event, Right?
William
Subreport1.DetailBand.BandsPerRecord = X. Use the Subreport1.BeforePrint
event to set BandsPerRecord and to parameterize the query. The grouping
should not matter, as the detail band is going to be reprinted. Only when
the group break value changes, will the group break. The group should finish
in the subreport and a group footer should appear. Then the detail is
reprinted and the new subreport prints with a new group header and group
footer for each group in the subreport2.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
Hmmm.... Where is the Subreport.BeforePrint event, I coundn't find such a
event for the subreport, The only one I can see is that Subreport only has
OnPrint event.
William
subreport is the OnStartFirstPass event of the Subreport.Report object.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com