Hi Fabian,
The following code runs error free on Crystal 8.5 and VFP8 using a free table to drive the report:
SET STEP ON
*
* initialize runtime objects
*
cReportFile = 'c:\vfpbeta\report2.rpt'
IF FILE(cReportFile)
*
* crystal application object
*
IF TYPE('oCrApplication') = 'U'
PUBLIC oCrApplication
oCrApplication = CREATEOBJECT('CrystalRuntime.Application')
ENDIF
*
* crystal report object
*
IF TYPE('oCrReport') = 'U'
PUBLIC oCrReport
oCrReport = CREATEOBJECT('CrystalRuntime.Report')
ENDIF
*
* update report object properties
*
oCrReport = oCrApplication.OpenReport(cReportFile) && open .rpt file
*
* loop through tables and set OLE DB server name
*
WITH oCrReport.Database
FOR nTableNo = 1 TO .Tables.Count
.Tables(nTableNo).Location = GETFILE() && location of free table
ENDFOR
ENDWITH
oCrReport.ExportOptions.DestinationType = 1 && Export the report to a file
oCrReport.ExportOptions.FormatType = 1 && Set the format
oCrReport.ExportOptions.DiskFileName = GETFILE() && Export file path
oCrReport.Export(.F.) && Export
ELSE
nResult = MESSAGEBOX('Could not locate specified report format.',16,'System Message')
RETURN .F.
ENDIF
If this doesn't run on Crystal 9 then maybe you should open a ticket w/ Crystal Decisions to find out why. Or, maybe consider reverting to Crystal 8.5. From what I saw, there wasn't anything in v9 that was particularly compelling. Don't know your situation...
Good luck,
Jeff
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only