badmotorvision
Programmer
Ok, Here is my code (From Macro after .net massaging)
The first place it pukes is the
POPOR1headerFields.Item("STCODE").Value = "104"
second place it pukes is the
POPOR1detail1.Insert()
This is straight from the macro what gives?
I dont understand
Dim Session As New AccpacCOMAPI.AccpacSession
Dim company, UserID, Password As String
company = Accpac_Interface.My.Settings.Company
UserID = My.Settings.UserID
Password = My.Settings.Password
Session.Init("", "XX", "XX1000", "55A")
Session.Open(UserID, Password, company, DateTime.Today, 0, "False")
Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Dim mDBLinkSysRW As AccpacCOMAPI.AccpacDBLink
mDBLinkCmpRW = Session.OpenDBLink(AccpacCOMAPI.tagDBLinkTypeEnum.DBLINK_COMPANY, AccpacCOMAPI.tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE)
mDBLinkSysRW = Session.OpenDBLink(AccpacCOMAPI.tagDBLinkTypeEnum.DBLINK_SYSTEM, AccpacCOMAPI.tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE)
Dim temp As Boolean
Dim POPOR1header As AccpacCOMAPI.AccpacView
Dim POPOR1headerFields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView("PO0620", POPOR1header)
POPOR1headerFields = POPOR1header.Fields
Dim POPOR1detail1 As AccpacCOMAPI.AccpacView
Dim POPOR1detail1Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView("PO0630", POPOR1detail1)
POPOR1detail1Fields = POPOR1detail1.Fields
Dim POPOR1detail2 As AccpacCOMAPI.AccpacView
Dim POPOR1detail2Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView("PO0610", POPOR1detail2)
POPOR1detail2Fields = POPOR1detail2.Fields
Dim POPOR1detail3 As AccpacCOMAPI.AccpacView
Dim POPOR1detail3Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView("PO0632", POPOR1detail3)
POPOR1detail3Fields = POPOR1detail3.Fields
Dim POPOR1detail4 As AccpacCOMAPI.AccpacView
Dim POPOR1detail4Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView("PO0619", POPOR1detail4)
POPOR1detail4Fields = POPOR1detail4.Fields
Dim POPOR1detail5 As AccpacCOMAPI.AccpacView
Dim POPOR1detail5Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView("PO0623", POPOR1detail5)
POPOR1detail5Fields = POPOR1detail5.Fields
Dim POPOR1detail6 As AccpacCOMAPI.AccpacView
Dim POPOR1detail6Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView("PO0633", POPOR1detail6)
POPOR1detail6Fields = POPOR1detail6.Fields
POPOR1header.Compose(New AccpacCOMAPI.AccpacView() {POPOR1detail2, POPOR1detail1, POPOR1detail3, POPOR1detail4, POPOR1detail5})
POPOR1detail1.Compose(New AccpacCOMAPI.AccpacView() {POPOR1header, POPOR1detail2, POPOR1detail4, Nothing, Nothing, POPOR1detail6})
POPOR1detail2.Compose(New AccpacCOMAPI.AccpacView() {POPOR1header, POPOR1detail1})
POPOR1detail3.Compose(New AccpacCOMAPI.AccpacView() {POPOR1header, POPOR1detail4})
POPOR1detail4.Compose(New AccpacCOMAPI.AccpacView() {POPOR1header, POPOR1detail2, POPOR1detail1, POPOR1detail3})
POPOR1detail5.Compose(New AccpacCOMAPI.AccpacView() {POPOR1header})
POPOR1detail6.Compose(New AccpacCOMAPI.AccpacView() {POPOR1detail1})
POPOR1header.Order = 1
POPOR1header.Order = 0
POPOR1headerFields.Item("PORHSEQ").PutWithoutVerification("0") ' Purchase Order Sequence Key
temp = POPOR1header.Exists
POPOR1header.Init()
POPOR1header.Order = 1
temp = POPOR1detail1.Exists
POPOR1detail1.RecordClear()
temp = POPOR1detail3.Exists
POPOR1detail3.Init()
temp = POPOR1detail2.Exists
POPOR1detail2.Init()
POPOR1headerFields.Item("PONUMBER").Value = "MIKEPOTEST5" ' Purchase Order Number
temp = POPOR1header.Exists
POPOR1headerFields.Item("VDCODE").Value = "4IM001" ' Vendor
POPOR1headerFields.Item("TEMPLATE").Value = "ACTIVE" ' Template Code
POPOR1detail4Fields.Item("TEMPLATE").Value = "ACTIVE" ' Template Code
POPOR1detail4Fields.Item("FUNCTION").Value = "5" ' Function
POPOR1detail4.Process()
Try
'POPOR1headerFields.Item("STCODE").PutWithoutVerification("104") ' Ship-To Location
POPOR1headerFields.Item("STCODE").Value = "104" ' Ship-To Location
Catch ex As Exception
End Try
Try
'POPOR1headerFields.FieldByName("STCODE").PutWithoutVerification("104")
Catch ex As Exception
End Try
POPOR1headerFields.Item("DESCRIPTIO").Value = "desc" ' Description
POPOR1headerFields.Item("REFERENCE").Value = "ref" ' Reference
temp = POPOR1detail1.Exists
POPOR1detail1.RecordClear()
temp = POPOR1detail1.Exists
POPOR1detail1.RecordCreate(0)
POPOR1detail1Fields.Item("ITEMNO").Value = "ASD" ' Item Number
POPOR1detail1Fields.Item("ITEMDESC").Value = "asdf" ' Item Description
POPOR1detail1Fields.Item("OQORDERED").Value = "1.0000" ' Quantity Ordered
POPOR1detail1Fields.Item("UNITCOST").Value = "12.000000" ' Unit Cost
POPOR1detail1.Insert()
POPOR1detail1Fields.Item("PORLREV").PutWithoutVerification("-1") ' Line Number
POPOR1detail1.Read()
POPOR1detail4Fields.Item("FUNCTION").PutWithoutVerification("8") ' Function
POPOR1detail4.Process()
temp = POPOR1header.Exists
POPOR1header.Insert()
temp = POPOR1header.Exists
POPOR1header.Init()
POPOR1header.Order = 0
POPOR1headerFields.Item("PORHSEQ").PutWithoutVerification("0") ' Purchase Order Sequence Key
temp = POPOR1header.Exists
POPOR1header.Init()
POPOR1header.Order = 1
temp = POPOR1detail1.Exists
POPOR1detail1.RecordClear()
temp = POPOR1detail3.Exists
POPOR1detail3.Init()
temp = POPOR1detail2.Exists
POPOR1detail2.Init()
The first place it pukes is the
POPOR1headerFields.Item("STCODE").Value = "104"
second place it pukes is the
POPOR1detail1.Insert()
This is straight from the macro what gives?
I dont understand
Dim Session As New AccpacCOMAPI.AccpacSession
Dim company, UserID, Password As String
company = Accpac_Interface.My.Settings.Company
UserID = My.Settings.UserID
Password = My.Settings.Password
Session.Init("", "XX", "XX1000", "55A")
Session.Open(UserID, Password, company, DateTime.Today, 0, "False")
Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Dim mDBLinkSysRW As AccpacCOMAPI.AccpacDBLink
mDBLinkCmpRW = Session.OpenDBLink(AccpacCOMAPI.tagDBLinkTypeEnum.DBLINK_COMPANY, AccpacCOMAPI.tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE)
mDBLinkSysRW = Session.OpenDBLink(AccpacCOMAPI.tagDBLinkTypeEnum.DBLINK_SYSTEM, AccpacCOMAPI.tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE)
Dim temp As Boolean
Dim POPOR1header As AccpacCOMAPI.AccpacView
Dim POPOR1headerFields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView("PO0620", POPOR1header)
POPOR1headerFields = POPOR1header.Fields
Dim POPOR1detail1 As AccpacCOMAPI.AccpacView
Dim POPOR1detail1Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView("PO0630", POPOR1detail1)
POPOR1detail1Fields = POPOR1detail1.Fields
Dim POPOR1detail2 As AccpacCOMAPI.AccpacView
Dim POPOR1detail2Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView("PO0610", POPOR1detail2)
POPOR1detail2Fields = POPOR1detail2.Fields
Dim POPOR1detail3 As AccpacCOMAPI.AccpacView
Dim POPOR1detail3Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView("PO0632", POPOR1detail3)
POPOR1detail3Fields = POPOR1detail3.Fields
Dim POPOR1detail4 As AccpacCOMAPI.AccpacView
Dim POPOR1detail4Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView("PO0619", POPOR1detail4)
POPOR1detail4Fields = POPOR1detail4.Fields
Dim POPOR1detail5 As AccpacCOMAPI.AccpacView
Dim POPOR1detail5Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView("PO0623", POPOR1detail5)
POPOR1detail5Fields = POPOR1detail5.Fields
Dim POPOR1detail6 As AccpacCOMAPI.AccpacView
Dim POPOR1detail6Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView("PO0633", POPOR1detail6)
POPOR1detail6Fields = POPOR1detail6.Fields
POPOR1header.Compose(New AccpacCOMAPI.AccpacView() {POPOR1detail2, POPOR1detail1, POPOR1detail3, POPOR1detail4, POPOR1detail5})
POPOR1detail1.Compose(New AccpacCOMAPI.AccpacView() {POPOR1header, POPOR1detail2, POPOR1detail4, Nothing, Nothing, POPOR1detail6})
POPOR1detail2.Compose(New AccpacCOMAPI.AccpacView() {POPOR1header, POPOR1detail1})
POPOR1detail3.Compose(New AccpacCOMAPI.AccpacView() {POPOR1header, POPOR1detail4})
POPOR1detail4.Compose(New AccpacCOMAPI.AccpacView() {POPOR1header, POPOR1detail2, POPOR1detail1, POPOR1detail3})
POPOR1detail5.Compose(New AccpacCOMAPI.AccpacView() {POPOR1header})
POPOR1detail6.Compose(New AccpacCOMAPI.AccpacView() {POPOR1detail1})
POPOR1header.Order = 1
POPOR1header.Order = 0
POPOR1headerFields.Item("PORHSEQ").PutWithoutVerification("0") ' Purchase Order Sequence Key
temp = POPOR1header.Exists
POPOR1header.Init()
POPOR1header.Order = 1
temp = POPOR1detail1.Exists
POPOR1detail1.RecordClear()
temp = POPOR1detail3.Exists
POPOR1detail3.Init()
temp = POPOR1detail2.Exists
POPOR1detail2.Init()
POPOR1headerFields.Item("PONUMBER").Value = "MIKEPOTEST5" ' Purchase Order Number
temp = POPOR1header.Exists
POPOR1headerFields.Item("VDCODE").Value = "4IM001" ' Vendor
POPOR1headerFields.Item("TEMPLATE").Value = "ACTIVE" ' Template Code
POPOR1detail4Fields.Item("TEMPLATE").Value = "ACTIVE" ' Template Code
POPOR1detail4Fields.Item("FUNCTION").Value = "5" ' Function
POPOR1detail4.Process()
Try
'POPOR1headerFields.Item("STCODE").PutWithoutVerification("104") ' Ship-To Location
POPOR1headerFields.Item("STCODE").Value = "104" ' Ship-To Location
Catch ex As Exception
End Try
Try
'POPOR1headerFields.FieldByName("STCODE").PutWithoutVerification("104")
Catch ex As Exception
End Try
POPOR1headerFields.Item("DESCRIPTIO").Value = "desc" ' Description
POPOR1headerFields.Item("REFERENCE").Value = "ref" ' Reference
temp = POPOR1detail1.Exists
POPOR1detail1.RecordClear()
temp = POPOR1detail1.Exists
POPOR1detail1.RecordCreate(0)
POPOR1detail1Fields.Item("ITEMNO").Value = "ASD" ' Item Number
POPOR1detail1Fields.Item("ITEMDESC").Value = "asdf" ' Item Description
POPOR1detail1Fields.Item("OQORDERED").Value = "1.0000" ' Quantity Ordered
POPOR1detail1Fields.Item("UNITCOST").Value = "12.000000" ' Unit Cost
POPOR1detail1.Insert()
POPOR1detail1Fields.Item("PORLREV").PutWithoutVerification("-1") ' Line Number
POPOR1detail1.Read()
POPOR1detail4Fields.Item("FUNCTION").PutWithoutVerification("8") ' Function
POPOR1detail4.Process()
temp = POPOR1header.Exists
POPOR1header.Insert()
temp = POPOR1header.Exists
POPOR1header.Init()
POPOR1header.Order = 0
POPOR1headerFields.Item("PORHSEQ").PutWithoutVerification("0") ' Purchase Order Sequence Key
temp = POPOR1header.Exists
POPOR1header.Init()
POPOR1header.Order = 1
temp = POPOR1detail1.Exists
POPOR1detail1.RecordClear()
temp = POPOR1detail3.Exists
POPOR1detail3.Init()
temp = POPOR1detail2.Exists
POPOR1detail2.Init()