Sales Order Line UDF Update during Invoice Data Entry

SOLVED

Hi, I am trying to write a script that zero's out a Sales Order UDF during Invoice Data Entry. This is what I have, but it is not zeroing in on the exact sales order in my lines and it doesn't seem to be writing back to the sales order, although I have not been able to test that far, since I have trouble with the first part. Can someone please help with this? Here is my current code:

if oSession.CompanyCode = "TTT" then

Dim oSOLines
Dim oSOOrder
OrderNo = ""
OrderNo1=""
Item = ""
oSOLines = ""
oSOrder = ""
PickQty=0

'*** Update and Insert Pick Qty to 0 ***
retVal = oBusObj.GetValue("SalesOrderNo$", OrderNo)
retVal = oSession.SetProgram(oSession.LookupTask("SO_SalesOrder_ui"))
oSOrder = oSession.GetObject("SO_SalesOrder_bus")
Set oSOrder = oSession.AsObject(oSOrder)
retVal = oSOrder.Find(OrderNo)
Set oSOLines = oSOrder.AsObject(oSOrder.Lines)
retVal = oSOLines.MoveFirst()
Do until(oSOrder.oSOLines.EOF)=1
'
retVal = oSOLines.GetValue("SalesOrderNo$", OrderNo1)
retVal = oSOLines.GetValue("ItemCode$", Item)
retVal = oSOLines.GetValue("UDF_PICK_QTY", PickQty)

retVal = oSOLines.SetValue("UDF_PICK_QTY", PickQty) 'set the qty to 0
retVal = oSOLines.Write()

retMsg = oSession.AsObject(oSession.UI).MessageBox("", OrderNo & " " & Item & " Pick Qty " & CStr(PickQty))
retVal = oSOLines.MoveNext()
loop


end if 'end company GLT