Home General

AV - AfterSendPage event

edited September 2001 in General
I am using RB 5.0 and Delphi 5. My application dynamically loads report
templates from a database based on user selection. Some reports have
subreports and some don't.

Sometimes, when running a report with no subreport AFTER running a report
with a subreport, I get an Access Violation accessing the data. I tracked
this down to
TppSubReport.SectionAfterSendPageEvent.

It seems that when the report without the subreport is run, AfterSendPage is
still pointing to SectionAfterSendPageEvent. However, since there is no
subreport, the property FPageGenerated, called in the first line of
Section..., has not been initialized, thus the access violation.

Does this have something to do with loading from a database? Is this
something that has come up before? If so, is there a patch or workaround?

Thanks.

Tom Marciniak

Comments

  • edited September 2001
    Follow-up:
    Did some additional testing and found that sometimes the AV occurred because
    the Band object referred to in TppSubReport.SectionAfterSendPageEvent was
    inaccessible.

    My application was setup to allow users to select reports, print them,
    select more reports, print them, etc. There was no obvious pattern to
    how/when the error occurred. My testers would select the same group of
    reports each time. They sometimes printed to the default printer, sometimes
    not. The only common items were:
    1. The AV popped up within 20 minutes of testing.
    2. The AV never occurred on the first pass.

    I rewrote the program so it created the form containing the report object
    when the user clicked on the Print button then freed the form when the
    current report set was done. So far, this is working; we will spend half of
    tommorrow testing this.

  • edited September 2001
    Haven't heard of this behavior before. There isn't anyhtign special about
    loading a template, wether from file or from a database which would give you
    this error. Did you have any results from further testing? We'll need more
    information on exactly what your app is doing with the reports. Perhaps if
    we could have a demo, we could see what is causing the band object to be
    inaccessible.

    Instead of creating a form everytime a report is to be loaded and printed,
    why not just keep the form and report component instantiated so it will
    already exist for the next report which is to be printed.


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.