Tearing my hair out on this one.
My goal is to look through detail purchase order detail lines looking for specific inventory items.
This is a button script on the Inventory Item Maintenance Screen. Sage 100 2018 Advanced (script is set to run on the server and allow external access is enabled for the company).
Unfortunately when I start to step through the records (MoveFirst) I get:
Error 65 Window element does not exist or already exists
Program PO_COMMONENTRYDETAIL.PVC
Statement 863
Class PO_PurchaseOrderDetail_bus
Method GetWarehouseQty
Note really sure how GetWarehouseQty is involved?
Relevant portion of the script is as follows:
' obtain access to Purchase Order Detail Line file
oPOLine = OSession.Getobject("PO_PurchaseOrderDetail_bus")
retval = oSession.AsObject(oSession.UI).Messagebox("POLine value is " & oPOLine ) ' returns 100089
if oPOLine <> 0 then
set oPOLine = oSession.Asobject(oPOline)
retval = oPOLine.SetIndex("KITEMWHSE") 'searching for items by the itemcode so use this index
retval = oSession.AsObject(oSession.UI).Messagebox("return value from setindex " & retval ) 'no error here
retval = oPOLine.SetBrowseFilter(itemcode)
retval = oSession.AsObject(oSession.UI).Messagebox("return value from setbrowsefilter " & retval ) 'no error here
retval = oPOLine.MoveFirst() <== ERROR OCCURS HERE
.... (details omitted)
END IF
Originally I did not use the SetIndex or SetBrowseFilter and got the same error.
Is it possible I have to open the PO_Header object as well?
Ideas?