Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

BeforePrint event in a subreport

edited July 2003 in General
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

Comments

  • edited July 2003
    Hi Yannis,

    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.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2003
    Thank you Nico.

    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

  • edited July 2003
    Hi Yannis,

    In this case, you might try using the Report.OnStartPage event. This event
    fires before the Headerband.OnBeforePrint as well.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.