I have big problems with using Crystal Reports with VFP7 using COM. The simpliest things which I try basicly by copy code from Advisor articles does not work...
What I have done to try it out is to create a report which just prints countires. If I have the table in the same directory as the report (or actually the same directory as specified when creating the report) everything works fine, I can even change the table name. But as soon as I try to print the report with a table from another directory I get the following error messeage:
ODBC Error: [Microsoft][ODBC Visual FoxPro Driver]File 'omcountry_rpt_2.dbf' does not exist.
Although it exist.
My code that is working:
oapp = CREATEOBJECT('crystalruntime.application')
oreport = oapp.OpenReport(lcrpt, 1)
oreport.Database.Tables.Item(1).Location = 'omcountry_rpt.dbf'
oreport.ReadRecords()
oreport.SelectPrinter('', GETPRINTER(), '')
oreport.PrintOut()
My code that is NOT working:
oapp = CREATEOBJECT('crystalruntime.application')
oreport = oapp.OpenReport(lcrpt, 1)
oreport.Database.Tables.Item(1).Location = 'e:\temp\omcountry_rpt_2.dbf'
oreport.ReadRecords()
And the strangest thing of all... This code works:
oapp = CREATEOBJECT('crystalruntime.application')
oreport = oapp.OpenReport(lcrpt, 1)
oreport.Database.Tables.Item(1).Location = 'e:\temp\omcountry_rpt.dbf'
oreport.ReadRecords()
oreport.SelectPrinter('', GETPRINTER(), '')
oreport.PrintOut()
The table name is the same as the original, but the file does not exist in that directory and has never done...
So how do I get Crystal Reports to understand that it should pick up a table from another directory?
Thanks in advance!
---( Mårten Törnquist )---