Print report from C# program error Unknown error 0x80040200


Hi All,

I have an error when trying to print custom report from my C# program.

System.Runtime.InteropServices.COMException (0x80004005): Unknown error 0x80040200
   at AccpacCOMSVR.AccpacSvrReportClass.PrintReport(Boolean& pWebReportGenerated, String& WebReportURL)
   at ACCPAC.Advantage.Server.Report.Print(Boolean& webReportGenerated, String& webReportURL)
   at ACCPAC.Advantage.Report.Print()

After referring to recorded macro, I try to use the same method/functions with C#, although I see the macro is using AccpacCOMAPI. In C# , I am using ACCPAC.Advantage.Report class. 

ACCPAC.Advantage.Report report = mSession.ReportSelect("CONSIGNMENTNOTE[ConsignmentNote.rpt]", "", "");
ACCPAC.Advantage.PrintSetup printSetup;
printSetup = mSession.GetPrintSetup("", "");
report.SetParam("docnum", this.consignmentnotextBox.Text);
report.SetParam("toloc", this.tolocpopupListTextBox.Text);

report.SetParam("transdatefrom", Convert.ToString(fromtransdate));
report.SetParam("transdateto", Convert.ToString(totransdate));

report.NumberOfCopies = 1;
report.Destination = printSetup.Destination;
report.Print(); // Error happen here

I have tested the rpt file and all working well. I added the description below to my icrpt.ini below:

paper size=1
2=docnum		STRING
3=toloc			STRING
4=transdatefrom		STRING
5=transdateto		STRING

Something is not correct but I do not know where when the error is just "Unknown error 0x80040200".

Can anyone help me please? 

Thank you

Parents Reply Children
No Data