Mark, you don't need to free the QR1 component - it is owned by the form and will get destroyed when the form destroys.
regards, Steve > -----Original Message----- > From: Mark Howard [mailto:[EMAIL PROTECTED] > Sent: Tuesday, 10 June 2003 1:42 p.m. > To: Multiple recipients of list delphi > Subject: [DUG]: Quick Reports Preview > > > Hi All > > I'm trying to give my users the ability to display (and > print) previously > run and saved Quick Reports (ie .QRP files). > > I must admit that (among other things) the structure of QuickReports > has been a considerable mystery to me. > > I have managed to get a Preview screen loaded with a saved report and > displayed. I can resize and navigate the pages of the report OK but > when I close the Preview I get an AV. > > I'd appreciate some help. It must be something to do with > not properly > freeing something. > > Below is what I have done. > > > > I have created a PreviewFm form and placed a TQuickRep component > (QR1) on this form. The AfterPreview event contains just a "Close" > statement. > > In my app I have the following procedure: > > procedure HandleViewReportsClick; //mh 2003-06-10 > begin > MainForm.OpenDialog.Filter := 'Report Files, *.qrp|*.QRP'; > MainForm.OpenDialog.Title := 'Select file to view'; > MainForm.OpenDialog.InitialDir := > ExtractFileDir(Application.ExeName); > > if MainForm.OpenDialog.Execute then try > Application.CreateForm(TPreviewFm, PreviewFm); > PreviewFm.QR1.Prepare; > try > PreviewFm.QR1.QRPrinter.Load(MainForm.OpenDialog.FileName); > PreviewFm.QR1.QRPrinter.Preview; > finally > PreviewFm.QR1.Free; > end; > finally > PreviewFm.free; > end > end; > > Any help greatly appreciated > > Mark > > -------------------------------------------------------------- > ------------- > 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" > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.488 / Virus Database: 287 - Release Date: 5/06/2003 > > --------------------------------------------------------------------------- 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" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/