Negative to Positive

D

donallen

Is there any way within Access to convert a negative number to a positive?
We are importing data that is both negative and positive but we are sending
this to a company that wants the "sign" + or - in one field and the number
in a separate field. Like this

Table 1
Number
2567.00
-428.90

Table 2
Sign Number
+ 2567.00
- 428.90

Thanks
Don
 
R

Roger Carlson

The ABS() function stands for Absolute value, which will return the positive
value for either a positive or negative number.
 
B

Brendan Reynolds

The Abs() function. For example ...

SELECT IIf([TestNumber]>=0,"+","-") AS TheSign, Abs([TestNumber]) AS
TheNumber
FROM tblTest;

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
D

Dev Ashish

Use the Sgn function, maybe with IIF.

?IIF(Sgn(-11)=-1,"-",IIF(sgn(-11)>1,"+",""))
 
B

Brendan Reynolds

This is true, of course, but there are exceptions to every rule. For
example, I remember an application that accepted text files from one
organisation (an international supermarket chain) processed the data, then
exported the results to another organisation (one of the major oil
companies). The last thing we wanted to do in that situation was to
encourage either of those two organisations to change anything, because a)
it took forever, and b) every time they changed anything, they broke
something else.

Sometimes, just giving them what they asked for really is the best policy!
:)

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Top