Forcing data to be a negative number

L

L.A. Lawyer

I am putting client payments in the same field as their bills.

Thus, I need to force payments, entered on a form, to be saved as a negative
number, no matter what.

I assume that some of the people entering the data will enter it as a
negative number and I need to insure that it is always negative.

How is that done?
 
S

Stefan Hoffmann

hi,

L.A. Lawyer said:
I assume that some of the people entering the data will enter it as a
negative number and I need to insure that it is always negative.
Use the forms Before Update event, e.g. something like:

Private Sub Form_BeforeUpdate(Cancel As Integer)

If IsNumeric(txtPayment.Value) Then
txtPayment.Value = -Abs(txtPayment.Value)
End If

End Sub



mfG
--> stefan <--
 
M

Maurice

How about validating the input and multiply that by -1 that should give you a
negative number. I don't know the setup but you could check in the before
update of the form. Check the textbox which holds the number and apply the
multiplier.
 

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