Compare field values on click

O

onmars

I have a Main form; InvoiceMain and a sub form; InvoiceDetail with a
button [NewRecord] on the main form that clicks to a new record on
InvoiceMain after InvoiceDetail is completed. On the main form I have a
text box [DetailTotal] that refers to the sum field [AccountCharge] on
the sub form InvoiceDetail.

When the NewRecord button is clicked, I would like to compare the
InvoiceMain fields [InvoiceTotal] to [DetailTotal]. If equal, go to
NewRecord. If not equal, message box and set focus to the sub form
field [CompanyUnit].

Can anyone recommend a code for this procedure?

Thanks.
 
Top