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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programatically set the output printer

Status
Not open for further replies.

StormbringerX

Programmer
Dec 14, 2000
102
US
Hi gang,

I'm somewhat new to Crystal Reports but I couldn't find any relevant FAQ's so excuse me if I'm re-asking the obvious.

I have a VB6 application using CR Version8. I'm using the crviewer to enable printing of a report whose data originates from SQLServer 2000. The report runs well and I have no problem. However, my company has designed a printer class that enables us to direct a particular workstation's output to a specific, pre-defined printer.

According to what I can find in the CR documentation, I should be able to set the CRReport.PrinterName, CRReport.PrinterDriver, and the CRReport.PrinterPort to define the printer I want the report to print to.

However, I keep receiving the error: Wrong number of arguments or invalid property assignment.

Here is the syntax I'm using:

crReport.PrinterName = objPrinterUsed.PrinterName
crReport.PortName = objPrinterUsed.Port
crReport.DriverName = objPrinterUsed.DriverName

These Statements are in the Form_Load of the CRForm (that contains the preview and the print button, etc...). I can remark any 2 of the 3 lines and it will hit the same error on the unremarked line. The objPrinterUsed object has the correct information for the printer that I'm wanting to use. And I can use the crReport.PrinterSetup and choose the same printer and print to it with no problem.

All other pieces of the app use this defined printer object with no problem, but I can't seem to figure out what crystal reports needs that I'm not giving.


Thanks.


Dave
 
That worked beautifully! Though I still wonder why the settings didn't work as the documentation stated. Won't lose any sleep over it though. Thanks again!

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top