Code to prevent data entry errors

R

Randy

I have this code to prevent data entry errors when [SumFee] (Currency) do
not add up on my form. It usually works fine. On a few occasions the fee's
did not balance. The user became distracted and inserted a new record, thus
allowing inaccurate entries to be entered in the table. I need a way to
prevent a new record being entered or moving back and forth between records
unless the [Sumfee] balances...Any Ideas?

Private Sub Totalfee_Exit(Cancel As Integer)
If Accountsubform.Form!SumFee <> [Debit] Then
If MsgBox("Total Fee's Do Not Agree. Review Fee's and make
necessary correction", vbYes + vbDefaultButton2) <> vbYes Then
Cancel = True
Me.Form![Debit].SetFocus
End If
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top