Hi Forum,
I am getting an error 0 in Method SETKEYVALUE trying to set the key for Sales Order Lines.
Below is the code i have. I can read the key of the Sales Order Header but i cannot read the Lines.
'Get Sales Order Header
retVal = o.nSetKeyValue("SalesOrderNo$", strOrderNo)
retHdrKey = o.nFind(strOrderNo)
If retHdrKey = 0 Then
MsgBox(o.sLastErrorMsg & strOrderNo & vbCRLF & "SO Header")
End If
r = o.nGetValue("ARDivisionNo$", sDiv)
r = o.nGetValue("CustomerNo$", CustNo)
r = o.nGetValue("CustomerPONo$", strcustPO)
msgbox "SO #: " & strOrderNo & " Customer #: " & CustNo
'Get Sales Order Detail
retVal = 0
retVal = o.oLines.nSetKeyValue("SalesOrderNo$", strOrderNo) *** here is where i get the error.
retVal = o.oLines.nSetKeyValue("LineKey$", sLine_Key)
retKey = o.oLines.nFind()
If retKey = 0 Then
MsgBox(o.sLastErrorMsg & vbCRLF & "SO Detail")
Else
msgbox "Found SO : " & strOrderNo
End If
I cannot figure out what is wrong. I copied this code from another script that is working.
What am I missing ?
Any suggestions ?
Regards,
Manuel