Hi John,

We have also had a lot of problems using the version of QuickReport that
shipped with D4, particularly regarding that printer setup button on the
preview screen.  We ended up having to upgrade QuickReport from their site
(www.qusoft.com I think it was), but just be aware that other third party
components like TeeChart will have to also be upgraded and recompiled if you
use those with QuickReport.

The problem you are seeing could be related to the call to "Preview" rather
than "PreviewModal", as the next line of code frees your form.  Also,
calling "Prepare" before "Preview" can help.  If that still fails, I have
attached a bit of (messy and long-winded!) code that we ended up using when
we were having similar problems...

    try

      try
        frmAuditTrail := TfrmAuditTrail.Create(Application);

        with frmAuditTrail do begin
          Screen.Cursor := crDefault;
          Application.ProcessMessages;  //Make sure the cursor is redrawn
          rptAuditTrail.Prepare;

          with rptAuditTrail.QRPrinter.Create do begin
            PrinterIndex := -1;    //Set to default printer
            rptAuditTrail.Page.PaperSize := PaperSize;  //Set to default
printer paper-size
            rptAuditTrail.PrinterSettings.OutputBin := OutputBin;  //Set to
default printer outputbin
          end;

          rptAuditTrail.PreviewModal;

          //This stops the following lines of code from occurring until the
report is closed.
          Repeat
            Application.ProcessMessages;
          until rptAuditTrail.QRPrinter = nil;

          Close;

        end;

      finally

        frmAuditTrail.Free;

      end;

    except

      ShowMessage('An Error occurred in loading the Audit trail report.');

    end;


Good luck!!

Regards,
Michael

> -----Original Message-----
> From: John Christenhusz [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, 28 August 2000 15:58
> To:   Multiple recipients of list delphi
> Subject:      [DUG]:  QuickReport
> Importance:   High
> 
> Hi folks,
> 
> I've got the following problem with Quickreport in D4, using a very simple
> report (just one textlabel on it):
> 
> When the QR-form is created from the project-file it works fine, but when
> I create the form at run-time, using the following code, then it causes an
> Access Violation error when closing the pre-view.
> But strangely enough this happens only after I have clicked the printer
> setup window from the preview screen (and closing it without any changes).
> 
> The code launching the report is as follows:
> 
> begin
>     Application.CreateForm(TForm2, Form2);
>     with form2 do
>     begin
>       QuickRep1.preview;
>       free;
>     end;
> end;
> 
> Any help is highly appreciated.
> 
> 
> John Christenhusz
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to