Hi,
I'm trying to write a macro for entering a PO line item comment but can't work out the error I get.
I've taken the code from a macro recording.
The error i get is: Method 'PutWithoutVerification' of object 'IAccpacViewField' failed.
I'm trying to write a macro for entering a PO line item comment but can't work out the error I get.
I've taken the code from a macro recording.
The error i get is: Method 'PutWithoutVerification' of object 'IAccpacViewField' failed.
Code:
Private Sub cmdSearch_Click()
Dim temp As Boolean
Dim POPOR1header As AccpacCOMAPI.AccpacView
Dim POPOR1headerFields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "PO0620", POPOR1header
Set POPOR1headerFields = POPOR1header.Fields
Dim POPOR1detail1 As AccpacCOMAPI.AccpacView
Dim POPOR1detail1Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "PO0630", POPOR1detail1
Set POPOR1detail1Fields = POPOR1detail1.Fields
Dim POPOR1detail2 As AccpacCOMAPI.AccpacView
Dim POPOR1detail2Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "PO0610", POPOR1detail2
Set POPOR1detail2Fields = POPOR1detail2.Fields
Dim POPOR1detail3 As AccpacCOMAPI.AccpacView
Dim POPOR1detail3Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "PO0632", POPOR1detail3
Set POPOR1detail3Fields = POPOR1detail3.Fields
Dim POPOR1detail4 As AccpacCOMAPI.AccpacView
Dim POPOR1detail4Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "PO0619", POPOR1detail4
Set POPOR1detail4Fields = POPOR1detail4.Fields
Dim POPOR1detail5 As AccpacCOMAPI.AccpacView
Dim POPOR1detail5Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "PO0623", POPOR1detail5
Set POPOR1detail5Fields = POPOR1detail5.Fields
Dim POPOR1detail6 As AccpacCOMAPI.AccpacView
Dim POPOR1detail6Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "PO0633", POPOR1detail6
Set POPOR1detail6Fields = POPOR1detail6.Fields
POPOR1header.Compose Array(POPOR1detail2, POPOR1detail1, POPOR1detail3, POPOR1detail4, POPOR1detail5)
POPOR1detail1.Compose Array(POPOR1header, POPOR1detail2, POPOR1detail4, Nothing, Nothing, POPOR1detail6)
POPOR1detail2.Compose Array(POPOR1header, POPOR1detail1)
POPOR1detail3.Compose Array(POPOR1header, POPOR1detail4)
POPOR1detail4.Compose Array(POPOR1header, POPOR1detail2, POPOR1detail1, POPOR1detail3)
POPOR1detail5.Compose Array(POPOR1header)
POPOR1detail6.Compose Array(POPOR1detail1)
POPOR1headerFields("PONUMBER").Value = "PO-0024100" ' Purchase Order Number
temp = POPOR1header.Exists
POPOR1header.Read
temp = POPOR1detail3.Exists
POPOR1detail3.Init
POPOR1detail3Fields("PORRREV").PutWithoutVerification ("-999999999999999999") ' Line Number
POPOR1detail3.Browse "", 1
POPOR1detail3.Fetch
temp = POPOR1detail2.Exists
POPOR1detail2.Init
POPOR1detail2Fields("PORCREV").PutWithoutVerification ("-999999999999999999") ' Comment Identifier
POPOR1detail2.Browse "", 1
POPOR1detail2.Fetch
POPOR1detail2.Browse "(COMMENTTYP = ""1"")", 1
temp = POPOR1detail2.Exists
POPOR1detail2.RecordClear
temp = POPOR1detail2.Exists
POPOR1detail2.RecordCreate 0
POPOR1detail2.Process
POPOR1detail2Fields("COMMENT").PutWithoutVerification ("test") ' Comments/Instructions
POPOR1detail2.Insert
End Sub