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

Acces violation when canceling a report pre-view

edited November 2001 in General
Hello,

How can I cancel the visualization of a report in a ppViewer and let a
ppreport completely clear?

I Tried to cancel a visualization and when I free the form, an access
violation occurs. It only occurs
sometimes. The error is "Access Violation in module 'ntdll.dll' ".
It seems to be the template of the ppReport that it can't free.
I have tried the next methods in different combinations: Report.Cancel,
Report.Reset, Template.New,
Template.Free, Viewer.Reset, Viewer.Cancel.
The objective is: Stop a long preview and free the form if the user wish
exit from the form.

Thanks for all

Comments

  • edited November 2001
    You'll want to free the report after the call to Report.Print or
    Report.PrintToDevices..


    procedure TForm1.btnPrintClick(Sender: TObject);
    begin

    ppReport1.PrintToDevices;

    if ppReport1.Engine.StopPrinting then
    begin
    ppReport1.Free;
    Close;
    end;

    end;

    procedure TForm1.btnCancelClick(Sender: TObject);
    begin
    ppViewer1.Cancel;
    end;



    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.