Access Violation on Report Free
I have a form where I'm using a TppViewer component. All of my reports
are contained in TForms. On the main form (where the TppViewer is), the
user selects reports from the menu bar.
The problem I'm having is when the application is closed while a report
is busy, or the user selects a new report from the menu bar while the
current report is busy. When this happens, the application crashes
(Access violation).
When a menu item is selected, or the application closes, I execute the
following code:
{currentReport is a public var, holding a reference to the TForm with
the TppReport}
currentReport.ppReport1.Cancel;
currentReport.ppReport1.Reset;
FreeAndNil(currentReport); {crashes here}
I've tried this with/without the ppReport1.Reset, but same results
occur. Can anyone help? (using RB 5.5, but tried 6.01, too.)
Thanks.
are contained in TForms. On the main form (where the TppViewer is), the
user selects reports from the menu bar.
The problem I'm having is when the application is closed while a report
is busy, or the user selects a new report from the menu bar while the
current report is busy. When this happens, the application crashes
(Access violation).
When a menu item is selected, or the application closes, I execute the
following code:
{currentReport is a public var, holding a reference to the TForm with
the TppReport}
currentReport.ppReport1.Cancel;
currentReport.ppReport1.Reset;
FreeAndNil(currentReport); {crashes here}
I've tried this with/without the ppReport1.Reset, but same results
occur. Can anyone help? (using RB 5.5, but tried 6.01, too.)
Thanks.
This discussion has been closed.
Comments
called. So, the viewer is still running when you free the report? You'll
want to stop the viewer before you free the report. You can call
Viewer.Cancel and and disconnect the report from the viewer.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
ppViewer1.Cancel, too:
ppViewer1.Cancel;
currentReport.ppReport1.Cancel;
FreeAndNil(currentReport);
Any ideas?
Thanks.