Hi progresstalker,
I am in a frustrating situation in troubleshooting a crystal report printing problem: I run the following code in the production eviroment, where a lot of shared printers are accessible, through remote desktop. However, after I select the printer, crystal report doesn't print the repor to it, but produces an error as attached.
Run the same code in our development server through remote desktop, the printing just works fine, very strange, any idea??
BTW, progress version is 10.1B.
View attachment 768
I am in a frustrating situation in troubleshooting a crystal report printing problem: I run the following code in the production eviroment, where a lot of shared printers are accessible, through remote desktop. However, after I select the printer, crystal report doesn't print the repor to it, but produces an error as attached.
Run the same code in our development server through remote desktop, the printing just works fine, very strange, any idea??
BTW, progress version is 10.1B.
Code:
DEFINE VARIABLE chApplication AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chReport AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chSubReport AS COM-HANDLE NO-UNDO.
DEFINE VAR cReport AS CHAR NO-UNDO.
CREATE 'CrystalRuntime.Application.10' chApplication NO-ERROR.
CREATE 'CrystalRuntime.Report.10' chReport NO-ERROR.
ASSIGN
creport = "D:/usr/crystal/debtor.rpt"
chReport = chApplication:OpenReport(cReport) NO-ERROR.
chConnProps = chReport:Database:Tables(1):ConnectionProperties NO-ERROR.
IF VALID-HANDLE(chConnProps) THEN DO:
chConnProps:DeleteAll NO-ERROR.
chConnProps:ADD("DSN", "") NO-ERROR.
chConnProps:ADD("User ID", "") NO-ERROR.
chConnProps:ADD("Password", "") NO-ERROR.
END.
chReport:SelectPrinter("winspool", SESSION:PRINTER-NAME, SESSION:PRINTER-PORT).
chReport:PrinterSetup(0).
chReport:PrintOut(TRUE).
View attachment 768