Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Code help to print CR 7.0 via VFP 6.0
Message
From
02/10/2002 09:46:09
Gene Conrad
Mechanical Advantage
Ronan, Montana, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Crystal Reports
Title:
Code help to print CR 7.0 via VFP 6.0
Miscellaneous
Thread ID:
00706835
Message ID:
00706835
Views:
47
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
Map
View

Click here to load this message in the networking platform