Information générale
Catégorie:
Crystal Reports
Did you "Save data with report"? If so, go to File-Options-Reporting and clear the save data with report option. This may help.
We use code similar to yours daily. The only difference I see is that we stuff the database name in a variable before setting it's location.
>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!
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement