Issue with button script/refresh grid

SUGGESTED

I have a button script in SO entry which uses the new invoke lookup function. The lookup calls the customer's price schedule list then after selecting it Adds that item to the order. The script works fine as long as the line is not the first line. If the line is the first time it forces focus to the totals tab. After the first line is written and you go back it never happens again. Anyone have any ideas???

Here is a copy of the script:

retVal = 0
val = ""
sDiv = ""
sCust = ""
sItem = ""

lookupCode = "IM_PriceCodeCust"

retVal = oBusObj.GetValue("ARDivisionNo$", sDiv)
retVal = oBusObj.GetValue("CustomerNo$", sCust)
set oLines = oBusObj.AsObject(oBusObj.Lines)

If lookupCode <> "" Then

retVal = oUIObj.InvokeLookup(LookupCode, val, sDiv + sCust + String(20 - Len(sCust),chr(0)))


If retVal<>0 And val<>"" Then


sItem = replace(mid(val,6,30),chr(0),"")
retVal = oLines.AddLine()
retVal = oLines.SetValue("ItemCode$", sItem)
retVal = oLines.Write()
oScript.LinesAdded = 1
retVal = oScript.LoadGrid("GD_Lines")
retVal = oUIObj.HandleScriptUI()

End If
End If