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.
 
J

Joseph Meehan

donallen said:
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

An interesting question. I suspect that in the long run they and you
are going to find it a problem. Part of any developer's job is to help the
client find out what they really want. Most people don't understand
databases and don't ask for what they really want, but they ask for what
they think they need to get what they want.
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top