subform calculation

subform calculation

Hi everyone

I have a subform with my quantity of sales per product. 
I want that with every row in my subform, the instock quantity in an other form be updated. 
This is what I'm doing:

for each eachRow in Articles
{
      getRecord = Stock[ID == input.Articles.Ref_article];
      getRecord.Instock=getRecord.Instock - input.Articles.Sortie_de_stock + input.Articles.Entr_e_en_stock;
}


The problem is: it update getRecord.Instock only for the first row of my subform.
Anyone can help me please? 

Thank you