Update a record from current subform to another form

Update a record from current subform to another form

Hi,

I am trying to update record from a current subform to another form, but failed for many times.

Here is my case:
  • Current Mainform: Inspection(Inspection_Nbr(SingleLine), Inspection_Date(Date), Product_Supplier(Lookup), Inspection_Subform(subform))
    • Lookup Field: Product_Supplier -- Supplier.ShortName
    • Current Subform: Inspection_Subform(Item(Lookup),Quantity(Number))
      • Lookup Field: Item -- PO_Subform.PO_Prdt
  • Another Form: PO_Subform(PO_ID(Lookup),Item(Lookup),Order_Qty(Number),Inspected_Qty(Number),PO_Prdt(SingleLine))
    • Lookup Field: PO_ID -- PO.ID
    • Lookup Field: Item -- Products.ID
    • SingleLine: PO_Product (Combine PO_ID and Item by script)

This is the script I wrote, written under On Add/Edit > On Success workflow:
  1. InsQty = PO_Subform[PO_Prdt == row.PO_Prdt];
  2. For each recRow in Inspection_Subform
  3. {
  4.             InsQty.Quantity = InsQty.Quantity + row.Quantity;
  5. }


The fact is my script failed and I can't figure out how to make it right.

Can someone here help me with this? Thanks!