Can´t submit a main Form with subform

Can´t submit a main Form with subform

Hi,

I'm trying to create an order sheet with fields like: "authorised by", "request by", "department". Then a subform with: "Product", "Quantity", "Price" and a "Subtotal" field per row. And finally a "Total" field in the main form which sums all Subtotal fields in every row of the subform.

Right now i have this scripts:

On user input:

input.total = 0.0;
row.Subtotal = 0.0;
for each row in Orders
{
    if (((row.Quantity  !=  null)  &&  (row.Price  !=  null))  &&  (row.Subtotal  !=  null))
    {
        input.total = (input.total  +  row.Quantity  *  row.Price);
        row.Subtotal = (row.Quantity  *  row.Price);
    }
}

On delete Row:

input.total = 0.0;
if (row.Quantity  !=  null)
{
    input.total = (input.total  -  row.Quantity  *  row.Price);
}
for each row in Orders
{
    if (row.Quantity  !=  null)
    {
        input.total = (input.total  +  row.Quantity  *  row.Price);
    }
}
total_Orders = input.total;


It seems to sums perfect when I fill all fields in the subform, and the Total field makes the sum of all subtotals perfect...UNTIL I press the submit button, after pressing I have this error: 

Invalid entries found

Please correct and submit again

1 . Orders*paidUserFieldError-subForm.

Sorry for my english, I'm from Spain.

Thanks for your help,

Alberto