-
Hi All,
I am doing an Access 2000 using VBA. I encounterd problem
converting positive digit into negative one and vice versa.
The case is like this, I had a list box when the user chose
"withdrawal", the amount(in a textbox) will be a negative value. On the contrary, if user chose deposit, the value will remain "positive". Can someone help me with the code and or the function.
Thanks alot.
Markus
-
just do this for withdrawal
if withdrawal = true and text1 > 0 then text1 = -text1 'self explanatory
do this for deposit
if deposit = true and text1 < 0 then text1 = -text1 'same thing
i hope this works, if not then tell me so i can think up something else
-
I had to do something similar, I used...
Code:
'Negative (Withdrawl)
Amount = Val("-" & Amount)
'Deposit (Positive)
Amount = Val(Amount)
-
if it is supposed to be negative
Code:
Dim numX As Integer
numX = 45
numX = numX - (numX * 2)
or positive
Code:
Dim numX As Integer
numX = 45
good, luck this does work for me
-
To get the number from negative to positive, just use Abs function:
Code:
Dim intNumber As Integer
'Just a test
intNumber = -250
'Make it positive
intNumber = Abs(intNumber)
'Make it negative
intNumber = intNumber * -1