Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing a crystal Rpt from VFP form

Status
Not open for further replies.

LenaS

Technical User
Nov 28, 2000
98
US
Need some instruction on sending a Crystal report to the printer from a command button or selecting a report from a drop-down list.
 
Just see thread184-10689 ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
LET KNOW IF THIS HELPED. ENOUGH EXPERTS ARE HERE TO HELP YOU OUT! BEST OF LUCK :)
 
Allo
I Have some code that I'm using to print a report in Crystal. I was working with the ver. 6.0 and use the activeX OCX but it's very limited. If you want a read OOP and a lot of control, go to 8.0 or even 8.5. With 8, you have a better control over your object. The data objects are better (a collection of tables, fields, ...).
Here some code for OCX and RDC. Hope it will Help..

LPARAMETER tcCRType, tnOutput

lcPrtDrv = "winspool"
lcPrtName = "HP DeskJet 810C Series Printer"
lcPrtPort = "USB/DeskJet 810C/SG93V1V10BGI"
lcReport = "c:\apps\inv\crystal\inv_fact01.RPT"

DO CASE
CASE tcCRType = "OCX" && Crystal Ver 6 or 7
loCrystalReport = NEWOBJECT("crystal.CrystalReport")

*** Open the report ***
loCrystalReport.ReportFileName = lcReport

*** Set the printer information ***
loCrystalReport.PrinterName = lcPrtName
loCrystalReport.PrinterDriver = lcPrtDrv
loCrystalReport.PrinterPort = lcPrtPort

*** Printing ***
IF tnOutput = "PRINTER"
loCrystalReport.ReportSource = 1 && 1 -> Printer
ELSE
loCrystalReport.ReportSource = 0 && 0 -> Preview
ENDIF
loQ9000Print.oCrystalReport.PrintReport


CASE tcCRType = "RDC" && Crystal Ver 8 and 8.5
loCrystalReport = NEWOBJECT("Crystal.CRPE.Application")

*** Open the report ***
loCrystalRp = loCrystalReport.OpenReport(lcReport)

*** Set the printer information ***
loCrystalRp.SelectPrinter(lcPrtDrv, lcPrtName, lcPrtPort)

IF tnOutput = "PRINTER" && -> Printer
loCrystalRp.Printout(.F.,1,.F.)
ELSE
loCrystalRp.Preview && -> Preview
ENDIF

ENDCASE
 
Ho !

By the way, I'm using VFP 6.0 SP5

Salut !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top