>Here is a copy of my Visual FoxPro 5.0 program…
>
>clea
>*Create Crystal Report Writer application object
>LCrwApp=Createobject('Crystal.CRPE.Application')
>*Create Open report variable
>LCrwRep=LCrwApp.OpenReport("\\Dp__NT\Dp_Work\admin\xics\statemnt\fed_sup\Archive\A.rpt")
>*Create Database variable
>LcrwDat=LCrwRep.Database
>*Create Database Table variable
>LcrwTab=LcrwDat.Tables
>
>LcrwItem1=LcrwTab.Item(1)
>Lname=LcrwItem1.Name
>? Lname
>LcrwItem1.SetLogOnInfo("Visual FoxPro Tables","repplan")
>LB=LcrwItem1.TestConnectivity
>? LB
>
>*Create Database Table Item variable Again
>LcrwItem2=LcrwTab.Item(2)
>Lname=LcrwItem2.Name
>? Lname
>
>LcrwItem2.SetLogOnInfo("Visual FoxPro Tables","repsrc")
>LB=LcrwItem2.TestConnectivity
>? LB
>
>LCrwRep.DiscardSavedData
>Lver=LcrwDat.verify
>*Create Export Options of the Open report variable
>LCrwExp=LCrwRep.ExportOptions
>LCrwExp.FormatType=4
>LCrwExp.DestinationType=1
>LCrwExp.DiskFileName='\\Dp__NT\Dp_Work\admin\xics\statemnt\fed_sup\Archive\CCCrtf.rtf'
>LCrwRep.Export(.f.)
>
>The first error message reads: “ODBC error[Microsoft][ODBC Visual FoxPro Driver]SQL: ‘Column ‘Name1’ is not found.”
>(Column Name1 is the first field from repplan used in the report)
>The second error message immediately following the first reads: “OLE IDispatch exception code 20527 from CPEAUT32:SQL server error”
Sounds like the table structure has changed since the report was designed. As good as Crystal is, one problem I've encountered with it is that if you change the fields in the table, you need to "Verify Database" in CR.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer