Having trouble with running my Crystal report that connects to SQL.
I can preview the report in Crystal, so I know the report works and the connection is good while in crystal. When I save the report and try to automate it from Fox, there is a connection error.
Connection error ( OLE ldispatch exception code 20599 cannot open SQL server )
The code -
**********************************
loCrystal = CREATEOBJECT('crystal.CRPE.Application')
loCrReport = loCrystal.OpenReport('M:\Lambson\SQLCrystal\Example1\SQLLens.rpt')
loCrDatabase = loCrReport.Database()
loCrExportOptions = loCrReport.ExportOptions()
*loCrDatabase.PassWord('BELBLUE')
loCrExportOptions.DestinationType = 1 && file format
loCrExportOptions.FormatType = 4 && rtf format
loCrExportOptions.DiskFilename = 'M:\Lambson\SQLCrystal\Example1\Test.rtf'
loCrReport.DiscardSavedData()
loCrReport.ParameterPromptingEnabled = .F.
loCrReport.Export(.F.)
**********************************
I am guessing that I need to add the password and/or userid throught the cry obj, that is likley the issue. Im just not sure how. Any ideas how.
Thanks - Evan (
elambson@contacts.com )