Help, Controlling Input

  • Thread starter Thread starter Reia
  • Start date Start date
R

Reia

Is there anyway I can do the following?:

I have a form where information is collected reguarding a
weeks payroll. Fields include Gross pay, Fed Tax
withheld, state tax withheld, Net Pay. I want to put a
check in place to assure that no data entry mistakes are
made.

Basically I need to be sure of the following: (Gross pay)-
(fed tax withheld)- State tax Withheld) = NET PAY.

In a case where there is a entry error, I need something
to prohibit the user from continuing.

What is the best way to accomplish this??? Thanks!!!
 
Is there anyway I can do the following?:

I have a form where information is collected reguarding a
weeks payroll. Fields include Gross pay, Fed Tax
withheld, state tax withheld, Net Pay. I want to put a
check in place to assure that no data entry mistakes are
made.

Basically I need to be sure of the following: (Gross pay)-
(fed tax withheld)- State tax Withheld) = NET PAY.

In a case where there is a entry error, I need something
to prohibit the user from continuing.

What is the best way to accomplish this??? Thanks!!!

You can do data validation checks in the forms before update event.
However, generally, you should not store a value that can be
calculated - like Net Pay.
If you are having the user input the Net Pay just as a validation
issue you might do something like...

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Nz(Me.txtGrossPay) + Nz(Me.txtFedTax) + _
Nz(Me.txtStateTax) <> Nz(Me.txtNetPay) Then
MsgBox "Entry error. Please check."
Cancel = True
End If
End Sub

- Jim
 
Back
Top