On the Pick Confirmation form, I do not want our Shipping Department to be able to confirm the pick if the Quantity Available is less than the Qty Picked. I am attempting to use a variable and Form Script for this. Here is the script I have written - that is not working. Any guidance the group can provide would be appreciated:
Sub AvailQty()
Dim i As Integer
Dim oCache As LoadCollectionResponseData
Dim NumRecs As Integer
Dim SumQty As Decimal
Dim iFilter As String
Dim oCache3 As IWSIDOCollection
oCache3 = ThisForm.GetSecondaryIDOCollection(2)
iFilter = "PickListId = '" + ThisForm.Variables("PicklistVar").Value + "'"
oCache = IDOClient.LoadCollection("SLPickListLocs", "PickListId, QtyPicked", iFilter, "", 0)
NumRecs = oCache.Items.Count
For i = 0 To NumRecs - 1
SumQty = SumQty + oCache(i, "QtyPicked").GetValue(Of Decimal)()
Next
ThisForm.Variables("vQtyAvail").Value = SumQty.ToSTring
End Sub