Hi all.
I have a problem with a report that uses Excel as a datasource.
I am using Crystal XI Professional, Delphi 7 and Excel 2002.
I have a Delphi application which uses the Crystal Reports viewer control to preview a report. The report displays OK, but when I close the form containing the control, I find that the Excel spreadsheet remains locked.
I am using the following code:
crReport := Application1.OpenReport(extractfilepath(forms.Application.ExeName) + 'Reports\Machine Scheduling.rpt',crOpenReportByTempCopy);
crReport.DiscardSavedData;
crReport.ParameterFields.GetItemByName('MachineCentre','').AddCurrentValue('CNC Turn') ;
CRViewer1.EnableExportButton := true;
CRViewer1.EnableGroupTree := false;
CRViewer1.ReportSource := crReport;
CRViewer1.ViewReport;
In the Form's OnClose event I have the following:
crReport._Release;
crReport := nil;
I've also tried adding:
Application1 := nil;
But this doesn't seem to make any difference!
I assume I'm missing a piece of code that will force Crystal to release the file?
Any help would be greatly appreciated.
Thanks in advance.
Dave
I have a problem with a report that uses Excel as a datasource.
I am using Crystal XI Professional, Delphi 7 and Excel 2002.
I have a Delphi application which uses the Crystal Reports viewer control to preview a report. The report displays OK, but when I close the form containing the control, I find that the Excel spreadsheet remains locked.
I am using the following code:
crReport := Application1.OpenReport(extractfilepath(forms.Application.ExeName) + 'Reports\Machine Scheduling.rpt',crOpenReportByTempCopy);
crReport.DiscardSavedData;
crReport.ParameterFields.GetItemByName('MachineCentre','').AddCurrentValue('CNC Turn') ;
CRViewer1.EnableExportButton := true;
CRViewer1.EnableGroupTree := false;
CRViewer1.ReportSource := crReport;
CRViewer1.ViewReport;
In the Form's OnClose event I have the following:
crReport._Release;
crReport := nil;
I've also tried adding:
Application1 := nil;
But this doesn't seem to make any difference!
I assume I'm missing a piece of code that will force Crystal to release the file?
Any help would be greatly appreciated.
Thanks in advance.
Dave