Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Crystal Reports - Locking table
Message
From
06/08/1999 11:35:49
 
 
To
05/08/1999 23:18:58
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00250336
Message ID:
00250709
Views:
21
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





>Mine works fine. Here's my code:
>
>
>loCRApp = CREATEOBJECT("Crystal.CRPE.Application")
>* Call crystal reports to create the Agency report
>loCrReport = loCRApp.OpenReport("D:\Work\AgLeads3.Rpt")
>loCrDatabase = loCrReport.Database()
>loCrExportOptions = loCrReport.ExportOptions()
>
>* Set the Crystal Report options
>loCrExportOptions.DestinationType = 1
>loCrExportOptions.FormatType = 4
>loCrExportOptions.DiskFileName = laAttach[lnAttach]
>loCrReport.DiscardSavedData()
>loCrReport.ParameterPromptingEnabled = .F.
>
>* Create the RTF file
>loCrReport.Export(.F.)
>
>* Reset the CR Options
>loCrExportOptions.Reset()
>
>* Clear the report objects
>loCrReport = .NULL.
>loCrDataBase = .NULL.
>loExportOptions = .NULL.
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform