i have the below Exception please any help ????
I always delete that line, it's not needed.
Re-record it, you're missing some code.
this is the whole Code there is nothing missing
'Reference to Accpac.Advantage.dll required
'To look for unprinted invoices and print them.
Dim mSession As New AccpacCOMAPI.AccpacSession 'declare a session
mSession.Init("", "CS", "CS0000", "56A") 'init the session
mSession.Open("ADMIN", "ADMIN", "CYBDAP", DateTime.Today, 0, "") 'open the session with appropriate credentials
Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Dim mDBLinkSysRW As AccpacCOMAPI.AccpacDBLink
mDBLinkCmpRW = mSession.OpenDBLink(AccpacCOMAPI.tagDBLinkTypeEnum.DBLINK_COMPANY, AccpacCOMAPI.tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE)
mDBLinkSysRW = mSession.OpenDBLink(AccpacCOMAPI.tagDBLinkTypeEnum.DBLINK_SYSTEM, AccpacCOMAPI.tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE)
Dim temp As Boolean
Dim rpt As AccpacCOMAPI.AccpacReport
rpt = mSession.ReportSelect("OEINV01[C:\SAGE300\OE61A\ENG\OEINV01.RPT]", " ", " ")
Dim rptPrintSetup As AccpacCOMAPI.AccpacPrintSetup
'rptPrintSetup = mSession.GetPrintSetup(" ", " ")
'rptPrintSetup.DeviceName = "Microsoft XPS Document Writer"
'rptPrintSetup.OutputName = "XPSPort:"
'rptPrintSetup.Orientation = 10
'rptPrintSetup.PaperSize = 9
'rptPrintSetup.PaperSource = 15
'rpt.PrinterSetup(rptPrintSetup)
rpt.SetParam("PRINTED", "1") ' Report parameter: 4
rpt.SetParam("DELMETHOD", "1") ' Report parameter: 6
rpt.SetParam("ECENABLED", "0") ' Report parameter: 7
rpt.SetParam("DIRECTEC", "0") ' Report parameter: 8
rpt.SetParam("QTYDEC", "0") ' Report parameter: 5 - O/E Sales History:Detail,Sort by Item Number
rpt.SetParam("BOITEM", "1") ' Report parameter: 9
rpt.SetParam("SORTFROM", "IN0000002") ' Report parameter: 2
rpt.SetParam("SORTTO", "IN0000002") ' Report parameter: 3
rpt.SetParam("SWDELMETHOD", "3") ' Report parameter: 10
rpt.SetParam("SERIALLOTNUMBERS", "0") ' Report parameter: 14
rpt.SetParam("PRINTKIT", "0") ' Report parameter: 11
rpt.SetParam("PRINTBOM", "0") ' Report parameter: 12
rpt.SetParam("RETAINAGE", "0") ' Report parameter: 13
rpt.SetParam("@SELECTION_CRITERIA", "(({OEINVH.INVNUMBER} >= ""IN0000002"") AND ({OEINVH.INVNUMBER} <= ""IN0000002""))") ' Report parameter: 0
rpt.SetParam("PRINTED", "1") ' Report parameter: 4
rpt.SetParam("DELMETHOD", "1") ' Report parameter: 6
rpt.SetParam("ECENABLED", "0") ' Report parameter: 7
rpt.SetParam("DIRECTEC", "0") ' Report parameter: 8
rpt.SetParam("QTYDEC", "0") ' Report parameter: 5 - O/E Sales History:Detail,Sort by Item Number
rpt.SetParam("BOITEM", "1") ' Report parameter: 9
rpt.SetParam("SORTFROM", "IN0000002") ' Report parameter: 2
rpt.SetParam("SORTTO", "IN0000002") ' Report parameter: 3
rpt.SetParam("SWDELMETHOD", "1") ' Report parameter: 10
rpt.SetParam("SERIALLOTNUMBERS", "0") ' Report parameter: 14
rpt.SetParam("PRINTKIT", "0") ' Report parameter: 11
rpt.SetParam("PRINTBOM", "0") ' Report parameter: 12
rpt.SetParam("RETAINAGE", "0") ' Report parameter: 13
rpt.SetParam("EMAILSENDTO", "[email protected]") ' Report parameter: 0
rpt.SetParam("EMAILSUBJECT", "CYBERIA - Middle East Internet Company Ltd. Invoice") ' Report parameter: 0
rpt.SetParam("EMAILTEXT", "Dear :\0D\0A\0D\0ATo view and print the attached invoice, double-click on the invoice icon, and then choose File, Print when the invoice is displayed. To save the invoice, copy it from this e-mail to another folder on your computer.\0D\0A\0D\0AIf you have any questions regarding this invoice, please contact me at .\0D\0A\0D\0ANote: You require Adobe Acrobat Reader to view this attachment. Adobe Acrobat Reader is available from www.adobe.com \0D\0A\0D\0ARegards,\0D\0A\0D\0AMajdi Abdul Qader") ' Report parameter: 0
rpt.SetParam("@SELECTION_CRITERIA", "{OEINVH.INVNUMBER} = ""IN0000002""") ' Report parameter: 0
rpt.NumOfCopies = 1
rpt.Destination = tagPrintDestinationEnum.PD_PREVIEW
rpt.PrintDir = "C:\sage300DATA\USER\ADMIN"
rpt.PrintReport()
rpt.SetParam("PRINTED", "1") ' Report parameter: 4
rpt.SetParam("DELMETHOD", "1") ' Report parameter: 6
rpt.SetParam("ECENABLED", "0") ' Report parameter: 7
rpt.SetParam("DIRECTEC", "0") ' Report parameter: 8
rpt.SetParam("QTYDEC", "0") ' Report parameter: 5 - O/E Sales History:Detail,Sort by Item Number
rpt.SetParam("BOITEM", "1") ' Report parameter: 9
rpt.SetParam("SORTFROM", "IN0000002") ' Report parameter: 2
rpt.SetParam("SORTTO", "IN0000002") ' Report parameter: 3
rpt.SetParam("SWDELMETHOD", "2") ' Report parameter: 10
rpt.SetParam("SERIALLOTNUMBERS", "0") ' Report parameter: 14
rpt.SetParam("PRINTKIT", "0") ' Report parameter: 11
rpt.SetParam("PRINTBOM", "0") ' Report parameter: 12
rpt.SetParam("RETAINAGE", "0") ' Report parameter: 13
rpt.SetParam("@SELECTION_CRITERIA", "(({OEINVH.INVNUMBER} >= ""IN0000002"") AND ({OEINVH.INVNUMBER} <= ""IN0000002"")) AND ({ARCUS.DELMETHOD} = 0)") ' Report parameter: 0
That is NOT from a recorded macro. And when you put it into VBA and fix the syntax errors, it works fine.
i cant understand you jay i make record then nothing changed only the session created
Why did you add a session? That's not required, you just run the macro in the company you want.
How to do this i need session to open dblink to company please help me how to do this without session
because ReportSelect,GetPrintSetup methods need sessions if i write like this give me error
rpt = ReportSelect("OEINV01[C:\SAGE300\OE61A\ENG\OEINV01.RPT]", " ", " ")
Dim rptPrintSetup As AccpacCOMAPI.AccpacPrintSetup
ptPrintSetup = GetPrintSetup(" ", " ")
Simply login to the different company, and run the macro.
anybody can help me please???
anybody can help me please???
I already told you. You don't need to add a session! Just login to the other company, and run the macro there.
i told you i cant understand you
my issue is to print the report in VS 2008 and there exceptions
why you told me to login to other company ???
Why VS2008? VBA is much simpler.
*Community Hub is the new name for Sage City