Hi, I'm using Accpac 6.
I'm trying to use below macro to update line item costs in a PO requisition.
Now this is Purchasing Workflow RQN, but the issue I have should apply for the standard RQN as well.
I basically want to add 7.5% to the line item cost, whci it does in my code, only the new cost does not show up on my RQN.
It seems like the .update does not work.
Do I need to set up the view compositions just to update the item cost?
Appreciate any help on this.
I'm trying to use below macro to update line item costs in a PO requisition.
Now this is Purchasing Workflow RQN, but the issue I have should apply for the standard RQN as well.
I basically want to add 7.5% to the line item cost, whci it does in my code, only the new cost does not show up on my RQN.
It seems like the .update does not work.
Do I need to set up the view compositions just to update the item cost?
Appreciate any help on this.
Code:
Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Set mDBLinkCmpRW = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)
Dim PTMACLOG As AccpacCOMAPI.AccpacView
mDBLinkCmpRW.OpenView "PT0036", PTMACLOG
Dim PTFNCTN As AccpacCOMAPI.AccpacView
mDBLinkCmpRW.OpenView "PT0900", PTFNCTN
Dim PTPRH As AccpacCOMAPI.AccpacView
mDBLinkCmpRW.OpenView "PT0040", PTPRH
Dim PTPRD As AccpacCOMAPI.AccpacView
Dim PTPRDFields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "PT0041", PTPRD
Set PTPRDFields = PTPRD.Fields
With PTMACLOG
.RecordClear
.Order = 1
.Browse "USERID=""" & strUserID & """ AND LOGSTATUS=1", True
If .Fetch Then
strWorkflow = .Fields("WORKFLOW").Value
strRQNNumber = .Fields("DOCNUMBER").Value
intWorkflowType = .Fields("WRKFLWTYPE").Value
dblSequence = .Fields("SEQUENCE").Value
dblMacroID = .Fields("MACLOGID").Value
'find RQN Number
With PTPRH
.RecordClear
.Order = 0 '
.Browse "RQNHSEQ=" & dblSequence & "", True
If .Fetch Then
'get details of RQN number
With PTPRD
.Order = 0
.Browse "RQNHSEQ=" & dblSequence & "", True
If .Fetch Then
.GoTop
Do
CurUnitCost = Round(.Fields("UNITCOST").Value * 1.075, 2)
PTPRDFields("UNITCOST").Value = CurUnitCost
.Update
Loop While .GoNext
End If
End With
PTPRH.Update
End If
End With