General information
Title:
Code help to print CR 7.0 via VFP 6.0
Hi,
I'm using Crystal 7.0 and VFP 6.0 and want to print a series of reports I have been working on the code below and think I am very close. The latest problem is that I get an unrecognized command error when trying to close the current report.
Maybe I don't need to close the current report? My thinking has been that once printed there is no need to keep the report open, so closing it would conserve resources? I've listed the code below and would welcome any help on the above problem, and also any suggestions as to how the code could be better.
Thanks so much,
Gene Conrad
Note that this code is part of a loop. The local variables, the createobject and the oCrystal.close() would normally be eslewhere in the loop, just wanted to show what I'm doing.
pcFile and pcPrinter are passed as parameters.
PRE
*- Setup the environment
local oCrystal, oReport, nItems
oCrystal = createobject("CrystalRuntime.Application")
oReport = oCrystal.OpenReport(pcFile,0)
*- Set the log-on information
nItems = oReport.Database.Tables.Count
For nX = 1 to nItems
oReport.Database.Tables.Item(nX).SetLogOnInfo("Visual FoxPro Tables", "", "", "")
Endfor
*- Print the report
oReport.SelectPrinter('',pcPrinter,'')
oReport.ReadRecords()
oReport.PrintOut(.F.,pnCopies)
do while oReport.PrintingStatus.Progress < 3
doevents
enddo
*- Cleanup
oReport.Close()
oCrystal.Close()
PRE
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only