I have a calculator form in Access that I am trying to create a +/- command button in. This should allow the user to switch a number from negative to positive and from positive to negative. Here is the code that I have written.
Private Sub NegativeOrPositive_Click()
If txtReadOut.Value > 0 Then txtReadOut.Value = "-" & Me!txtReadOut.Value
If txtReadOut.Value < 0 Then txtReadOut.Value = " " & Me!txtReadOut.Value
End Sub
changing the number from positive to negative works beautifully, but when I try to switch it from a positive to a negative it stays a negative number. I know that is because of the second If statement. The value that it is using for the Me!txtReadOut.Value field is already a negative number so all it does is put a space infront of the negative number and displays that. Here is my question...how do I get the second statement to not use Me!txtReadOut.Value as a negative number? Is there different code that should be used for this all together?
Thanks,
Jennifer
Private Sub NegativeOrPositive_Click()
If txtReadOut.Value > 0 Then txtReadOut.Value = "-" & Me!txtReadOut.Value
If txtReadOut.Value < 0 Then txtReadOut.Value = " " & Me!txtReadOut.Value
End Sub
changing the number from positive to negative works beautifully, but when I try to switch it from a positive to a negative it stays a negative number. I know that is because of the second If statement. The value that it is using for the Me!txtReadOut.Value field is already a negative number so all it does is put a space infront of the negative number and displays that. Here is my question...how do I get the second statement to not use Me!txtReadOut.Value as a negative number? Is there different code that should be used for this all together?
Thanks,
Jennifer