BeforePrint event in a subreport
I have a report with some RAP code in the BeforePrint event. Sometimes this
report is printed as a dynamically loaded subreport "inside" another "main"
report. In this case I get the message
"Unable to load BeforePrint code for report. BeforePrint is not a valid
event for a ChildReport"
when the report loads.
I understand the logic of the message and I have solved my problem by
putting the code of the BeforePrint event in the HeaderBeforePrint event (I
assume I can put it in the title BeforePrint event as well) . However this
solution might not always be feasible. Is there a workaround ?
Should we avoid putting RAP code in report events when the report is used as
a subreport?
Thanks
Yannis
report is printed as a dynamically loaded subreport "inside" another "main"
report. In this case I get the message
"Unable to load BeforePrint code for report. BeforePrint is not a valid
event for a ChildReport"
when the report loads.
I understand the logic of the message and I have solved my problem by
putting the code of the BeforePrint event in the HeaderBeforePrint event (I
assume I can put it in the title BeforePrint event as well) . However this
solution might not always be feasible. Is there a workaround ?
Should we avoid putting RAP code in report events when the report is used as
a subreport?
Thanks
Yannis
This discussion has been closed.
Comments
Try using the SubReport.OnPrint event. In my testing, it looks as though
this event fires before both the HeaderBand.BeforePrint and
Subreport.Report.StartPage.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
The OnPrint event exists only in SubReports , I think. So if we want a
report to function both by itself and as a dynamically loaded subreport (ie
one that is created as a separate report) then it seems we cannot use this
solution.
Yannis
In this case, you might try using the Report.OnStartPage event. This event
fires before the Headerband.OnBeforePrint as well.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com