Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using OLE DB with Crystal Reports 9
Message
 
To
27/11/2002 15:48:39
Fabian Valencia
Calamos Asset Managment Inc.
Naperville, Illinois, United States
General information
Forum:
Visual FoxPro
Category:
Crystal Reports
Miscellaneous
Thread ID:
00727754
Message ID:
00728901
Views:
22
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
Map
View

Click here to load this message in the networking platform