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

Cancelling a report from a Delphi Form

edited April 2003 in RAP
D7, RB7, Interbase

I have a report that I have coded a pass through function for that calls a
Delphi form I have designed.

On the form I have the option to cancel the report in which case the result
of the function is False.

How do I get an RB report file to just close without doing anything else if
the result of my function is false.

eg If not myFunction
then Report.Terminate

TIA

Rhonda Ridge

Comments

  • edited May 2003
    You'll need to call Report.Cancel to stop the report from generating. Then
    you can try closing the preview form. I tried it, but I needed to use a
    timer to wait until after the form shown and was able to be closed.

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    ppReport1.print;
    end;

    procedure TForm1.ppReport1EndFirstPass(Sender: TObject);
    begin
    Timer1.Enabled := True;
    end;

    {this is the timer's OnTimer event handler. I set the interval to 100.}
    procedure TForm1.Timer1Timer(Sender: TObject);
    begin
    ppReport1.Cancel;

    if ppReport1.PreviewForm <> nil then
    ppReport1.PreviewForm.Close;
    end;


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited May 2003
    Thanks Jim, I'll give it a try.

This discussion has been closed.