|
-
May 31st, 2000, 11:31 AM
#1
Thread Starter
New Member
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
-
May 31st, 2000, 12:35 PM
#2
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
-
May 31st, 2000, 01:50 PM
#3
Addicted Member
I had to do something similar, I used...
Code:
'Negative (Withdrawl)
Amount = Val("-" & Amount)
'Deposit (Positive)
Amount = Val(Amount)
-
May 31st, 2000, 03:16 PM
#4
Conquistador
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
-
May 31st, 2000, 08:43 PM
#5
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|