Home Subreports

TppSubReport & Preview : AV

edited September 2002 in Subreports
I just installed RB7 Enterprise for D6 Prof.

When I run Demo '3. EndUser', '5. Dynamic SubReport Loading' and try to
preview the report I get an Access Violation.

Any fixes or workarounds ?

Thanks,

Samuel

Comments

  • edited September 2002
    The detail band engine was getting freed for which the subreport was relying
    on. Since the dynamic subreport loading technique in this demo loads the
    template after the engine begins generating, you need to reset the
    subreport's report's engine after loading the template.

    procedure TmyDynamicLoadingSubReport.LoadSubreport;
    begin

    if (Band is TppTitleBand) then
    LoadTitleSubreport

    else if (Band is TppHeaderBand) then
    LoadHeaderSubreport

    else if (Band is TppFooterBand) then
    LoadFooterSubreport;

    Report.Engine.Reset;

    end;


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited September 2002
    Almost, the problem still exists if you first go to Preview, then change
    something in the design tab and then go back to the Preview.

    Samuel.


  • edited September 2002
    The engine is not going to let us get away with resetting it once. We need
    to tell it that it hasn't been initialized because we just loaded a template
    without it knowing it.

    Instead of Report.Engine.Reset, call these two lines of code in its place in
    TmyDynamicLoadingSubReport.LoadSubreport after the tempalte is loaded:

    Report.Engine.State := Report.Engine.State - [esInitialized];
    Init;



    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited September 2002
    Thanks Jim, that works fine now !


This discussion has been closed.