Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Forcing data to be a negative number

Geek News

Forcing data to be a negative number
"L.A. Lawyer" <kapplaw[ at ]linkline.com> 12/15/2008 5:52:12 PM
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?


Re: Forcing data to be a negative number
Stefan Hoffmann <ste5an[ at ]ste5an.de> 12/15/2008 6:18:05 PM
hi,

L.A. Lawyer wrote:
[Quoted Text]
> 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 <--
RE: Forcing data to be a negative number
Maurice 12/15/2008 6:18:13 PM
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.
--
Maurice Ausum


"L.A. Lawyer" wrote:

[Quoted Text]
> 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?
>
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net