OpenPrinter_1: rc:0 lastError:1801(0x709) The printer name is invalid

When I open or active the report in Dynamics AX 2009,system will pop up this Error message.

Error message as below:

OpenPrinter_1: rc:0 lastError:1801(0x709) The printer name is invalid.

Recently we were able to solve an issue with the print medium on certain reports. It is not changed immediately in a report print dialog option when it is generated from a class that extends RunBaseReportDialog.
This works fine when printing a standard report without extending from the RunBaseReportDialog class, (menu item object type is report).

The problem was caused by the following code line in method Classes/RunBaseReportDialog/main().
The prompt is called from the reportRun object instead of the reportDialog object .

res = reportRun.prompt();


To solve the problem we therefore had to change the code line like this:

res = reportDialog.prompt();

Classes - > RunBaseReportDialog - > main() method as below:

static void main(Args args)
{
RunBaseReportDialog reportDialog
= new RunBaseReportDialog(args.caller());
RunBaseReport runBaseReport
= args.caller().runbase();
ReportRun reportRun
= runBaseReport.reportRun();
Report report
= reportRun.report();
boolean oldInteractive;
boolean res;
Dialog dialog;
;
// We must invoke the SysPrintForm via the report object so that we honor an prompt overrides.
oldInteractive = report.interactive();
report.interactive(
true);

//res = reportRun.prompt();//removed by Jimmy 2010-12-28
res = reportDialog.prompt();//Added by Jimmy 2010-12-28

report.interactive(oldInteractive);
if (!res)
return;

dialog
= Dialog::getDialogFromCaller(args.caller());
if (dialog)
{
dialog.updateServer();
}
runBaseReport.dialogUpdatePrinterSettings(dialog);
reportDialog.run();
}

annother method just reset user data  and set the report - > design (property)- >  orientation (Portrait / Landscape set up as Auto)

posted @ 2010-12-28 18:42  Fandy Xie  Views(3477)  Comments(0Edit  收藏  举报