Calculate field value based on subform entires

Calculate field value based on subform entires

So I was wondering if someone could help with this.

if we have a form, lets call it orders, and it tracks an oirder for X number of hours work

then we have a subform which records the hours

e.g. an order for 5 hours comes through and it gets broken up into say a 2 hour block, a 2.5 hour block and a 0.5 hour block, these hours are recorded on the subfoirm.

Can I have the subform update the number of hours on the main form, possibly even stop entry of the subform record if it exceeds the value in the main form.