I'm getting an error stating "Error 20 Syntax Error. Program: SY_Commonui.pvc" when I loop through a UDT using a button script. Perhaps I have a typo or other mistake here. It appears to be crashing on the eof check (highlighted in green). Any ideas where I've goofed?
Thanks!
oUDT = oSession.GetObject("CM_UDTMaint_bus", "SO_UDT_Phantom_Kits")
if oUDT = 0 then 'run if user has permission to access UDT (oUDT would be zero if insufficient permissions)
else 'continue if user has permissions
Set oUDT = oScript.AsObject(oUDT)
retVal = oUDT.SetBrowseFilter(sPhantom)
retval = oUDT.MoveFirst() 'start looping through ALL UDT records to search for this phantom item
Do While Not(CBool(oUDT.EOF)) 'appears to error here
retval = oUDT.GetValue("UDF_Phantom_Kit$", sPhantomCheck)
if retval = 0 then
retval = oSession.AsObject(oSession.UI).MessageBox("Error reading UDF_Phantom_Kit from SO_UDT_Phantom_Kits" & vbcrlf & oUDT.LastErrorMsg)
end if
'retVal = oSession.AsObject(oSession.UI).MessageBox("Phantom Kit: " & sPhantom & vbcrlf & "Phantom Check: " & sPhantomCheck)
retval = oUDT.MoveNext()
oScript.LinesAdded = -1
Loop