Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Crystal Reports - Locking table
Message
From
06/08/1999 12:57:11
 
 
To
06/08/1999 11:35:49
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00250336
Message ID:
00250759
Views:
19
>Hi Craig
>
>Thanks. It looks like you are using Crystal as an automation server. I am using the Crystal component that ships with Visual Studio 6 which is an OCX. Here is my code which works fine to print the report file, but generates a 'File Access Denied' error when attempting to delete the temp data file after the report is printed. It's strange because at that point, the crystal object has been released and I issue a 'CLOSE DATA ALL' just to be safe. If I shut down VFP, I can then delete the temp file. By the way, I am using temp data files since the VFP automation server is going to be called from ASP pages and there may be several users running this report simultaneously with different data sets.
>
>
>
>SET DEFAULT TO (this.cAppStartPath)
>
>* Create a temporary data file.
>lcTempFile = SYS(3) + ".dbf"
>SELECT calldata
>COPY TO (lcTempFile)
>CLOSE DATA ALL
>
>loReport = CreateObject("Crystal.CrystalReport")
>
>* Set the report object properties.
>loReport.ReportFileName = this.cAppStartPath + "calldata.rpt"
>loReport.Destination = 2 && disk file
>loReport.PrintFileName = lcOutputFile && name of output file
>loReport.PrintFileType = 15 && RTF file
>
>* Assign the temporary database to the crystal reports object.
>loReport.RetrieveDataFiles()
>loReport.DataFiles(0) = this.cAppStartPath + lcTempFile
>
>* Generate the output file.
>lnResult = loReport.PrintReport()
>
>RELEASE loReport
>
>CLOSE DATA ALL
>IF !EMPTY(lcTempFile)
> IF FILE(lcTempFile)
> DELETE FILE (lcTempFile)
> ENDIF
>ENDIF
>
>RETURN lnResult = 0
>

>


What happens if you do loReport = NULL instead of RELEASE loReport?
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform