Update Inventory of different Warehouses and different product

Update Inventory of different Warehouses and different product

I have two forms

Form "Warehouse" having fields
WH_Code
WH_Description

Form "Products" having fields
Product_ID
Product_Description

Now I have made a form "Stock_Status" having fields:
Lookup field WH_Code
Lookup field Product_ID
Stock_In_Hand

I have two more forms named "Arrival" and "Despatch" which contains information of Material arrived and despatched.

I understand that I have to create a function to update Stock_In_Hand field in "Stock_Status" form "on success" of form "Arrival" and "Despatch" but I am unable to understand how to proceed. Please guide.