Standard Deviation in a subform

Standard Deviation in a subform

Hi,

I have a subform (named Samples) in order to add multiple rows with Total_Weight and Number_of_Samples.
I would like to calculate the Standard Deviation of the samples and display it in the form (the parent one)

I worked an script that use On user Input of Total_Weight and Number_of_Samples. Nevertheless it requires a huge amount of iterations, then I would like to do the calculation just one time (when the people fills all the rows or something like that)

Do you know what is the more efficient method or script for that?

Thank you,

David