Help, Controlling Input

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!!!
 
J

Jim Allensworth

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
 

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