Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OLE error while using Crystal Reports

Status
Not open for further replies.

PatMcLaughlin

Programmer
Dec 10, 2010
97
US
I have created a cursor (DBINFO) and copied data into it to use in a crystal report form stored in the C:\ drive of the computer running this file. I need it to create a pdf from the data in the cursor.

* Create ADO recordset, and copy DBINFO cursor data into it
loVFPCom = CreateObject("Vfpcom.Comutil")
loDBINFO = CreateObject("ADODB.Recordset")
lnError = loVFPCom.CursorToRS(loDBINFO, "DBINFO")

* Create report object and connect to datasource
loCrystal=CreateObject("CrystalRuntime.Application")
loReport=loCrystal.OpenReport("c:\vfp\ka\runtime\wrrept04.rpt",1)
loReport.Database.Tables(1).SetDataSource(loDBINFO, 3)

loReport.ExportOptions.DestinationType = crEDTDiskFile
loReport.ExportOptions.FormatType = crEFTPortableDocFormat
loReport.ExportOptions.DiskFileName = lcFileName
loReport.Export(.F.)

It works fine to the last line (loReport.Export(.F.)) then shoots out the following error

OLE IDispatch exception code 0 from Crystal Reports ActiveX Designer: A number is required hereOLE IDispatch exception code 0 from Crystal Reports ActiveX Designer: A number is required here.

This code works for many other applications in this program but not this time. I'm stumped.
 
It's difficult to answer this without knowing more about the report and the data.

Judging by the wording of the message, I would guess that the error is in one of the formulas in the report. Have you tried exporting the report interactively, that is, from within CR? That would give you some more information to work with.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top