Crystal report printing problem

ruan007

New Member
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.

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
 

Attachments

  • error.doc
    68.5 KB · Views: 18

4GLNewbie

Member
I would suggest you to verify the two printer settings first and check if the're equal.
Then to be sure that the user/psw you use in your code work fine even connecting the printer on the production server.
At least can you somehow create a document in CR in preview and verify it can be printed where it does not work?

Seems some system settings trouble rather than a progress one to me ... but i can be wrong.
 

ruan007

New Member
The printing problem only occurs when trying to run the program via remote desktop on production and it works when logging into the machine locally (i.e. not via remote desktop).

I can render the data on a CR viewer, but still can't print.
 

4GLNewbie

Member
Sorry i have been unable to access forum for a while.

You say that on another server it works even if logged through rd ( remote desktop ).
But it's difficult to say where it's the problem, maybe something in the two servers installation of CR it's different or there's some issue in the user profile you use to login or even in the printers drivers/settings.

You can try to see if sharing one printer from the good server with the second one ( and also use the same drivers and settings ) works fine or has troubles for example..
 
Top