Make Entry a Negative Number

KCK

Registered User.
Local time
Yesterday, 21:04
Joined
Aug 18, 2006
Messages
37
Hello,
I have a form used for data entry purposes and the numbers entered must always be negative (to show a credit). I searched the posts and found information explaining to use =Abs([Freight_Credit_Value])*-1 in the control source of the control. I thought I did that but it still doesn't work. I obviously did not do it correctly. Attached is the database with the form. Can somebody kindly review it and expalin what I am doing wrong?

Thanks,
Kerry
 

Attachments

If your form is expecting/displaying data in a normal format ie with no leading minus symbol then by multiplying a positive by -1 will turn it into a negative, however the same applies in reverse multiplying a negative by -1 will turn it into a positive. You may need to check your actual table to see what value is being stored pos or neg.

David
 
Would it be easier for the user to enter -123.05 then for you to spend time trying to turn 123.05 into a negative number?
 
The form will be used by several people and the resulting data must always be negative.

I have tried entering positive numbers and negative numbers and each is saved to the table exactly as how they are entered.

If someone could look at the file attached to my original post and explain what I am doing wrong or why it is not working I would really appreciate it.

Thanks,
Kerry
 
Remove =Abs([Freight_Credit_Value]*-1) from the After Update and changge the After Update to an [Event Procedure] then enter the following code.

Private Sub Freight_Credit_Value_AfterUpdate()
Me!Freight_Credit_Value = 0 - Me!Freight_Credit_Value
End Sub

If you enter 25 it changes to -25
 

Attachments

Last edited:
Or you could add the following code to the After Update:

If Me.Freight_Credit_Value > 0 Then
Me!Freight_Credit_Value = Me!Freight_Credit_Value * -1
End If

This way, it checks to see if the user put in a positive number or negative number. If it's negative, it will maintain it...if it's a positive number, it will change it to negative.
 
That did the trick! Thanks for everyone's input and help!
 

Users who are viewing this thread

Back
Top Bottom