473,411 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

negative

i have a field that holds currency formatted numbers. how would I make it so that all values entered in this field would be
negative?
thanks in advance
Nov 13 '05 #1
6 3901
In the AfterUpdate event of the field, you could perhaps add something like:
Me.your_field.Value = Me.your_field.Value * -1

Mark

<jj****@earthlink.net> wrote in message
news:fL*****************@newsread3.news.pas.earthl ink.net...
i have a field that holds currency formatted numbers. how would I make it
so that all values entered in this field would be negative?
thanks in advance

Nov 13 '05 #2
This can be done in a form, but not in the table itself. mark gave a good
idea, but what if the user types it in as a negative to begin with. Modify
the equation slightly.

Me.your_field.Value = Abs(Me.your_field.Value) * -1

--
Wayne Morgan
Microsoft Access MVP
"Mark" <ma**********@ntlworld.com> wrote in message
news:4_**************@newsfe1-win.ntli.net...
In the AfterUpdate event of the field, you could perhaps add something
like: Me.your_field.Value = Me.your_field.Value * -1

Nov 13 '05 #3
Hi Wayne,
could you explain what the 'Abs' is doing?

Cheers,

Mark

"Wayne Morgan" <co***************************@hotmail.com> wrote in message
news:tR****************@newssvr33.news.prodigy.com ...
This can be done in a form, but not in the table itself. mark gave a good
idea, but what if the user types it in as a negative to begin with. Modify
the equation slightly.

Me.your_field.Value = Abs(Me.your_field.Value) * -1

--
Wayne Morgan
Microsoft Access MVP
"Mark" <ma**********@ntlworld.com> wrote in message
news:4_**************@newsfe1-win.ntli.net...
In the AfterUpdate event of the field, you could perhaps add something
like: Me.your_field.Value = Me.your_field.Value * -1


Nov 13 '05 #4
Certainly, the Abs() function is Absolute Value. If the user enters a
negative number (knowing that you're wanting a negative number), such as -2,
then (-2)*(-1) is 2, a positive number. However, the poster wants to always
store a negative value. The absolute value function will always give a
positive number (or zero, of course), so that when you multiply by -1, the
value will be negative.

Abs(-2) is 2
Abs(2) is 2
2*(-1) is -2

--
Wayne Morgan
Microsoft Access MVP
"Mark" <ma**********@ntlworld.com> wrote in message
news:7J***********@newsfe5-gui.ntli.net...
Hi Wayne,
could you explain what the 'Abs' is doing?

Nov 13 '05 #5
"Mark" <ma**********@ntlworld.com> wrote:
could you explain what the 'Abs' is doing?


'Absolute' value, ie 'unsigned'. This takes care of a negative value
entered by the user by taking the magnitude of the value only.

Regards,
Keith.
www.keithwilby.com
Nov 13 '05 #6
Cheers Wayne, a very in-depth and helpful reply.

Mark

"Wayne Morgan" <co***************************@hotmail.com> wrote in message
news:iE****************@newssvr33.news.prodigy.com ...
Certainly, the Abs() function is Absolute Value. If the user enters a
negative number (knowing that you're wanting a negative number), such
as -2, then (-2)*(-1) is 2, a positive number. However, the poster wants
to always store a negative value. The absolute value function will always
give a positive number (or zero, of course), so that when you multiply
by -1, the value will be negative.

Abs(-2) is 2
Abs(2) is 2
2*(-1) is -2

--
Wayne Morgan
Microsoft Access MVP
"Mark" <ma**********@ntlworld.com> wrote in message
news:7J***********@newsfe5-gui.ntli.net...
Hi Wayne,
could you explain what the 'Abs' is doing?


Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: pj | last post by:
Why does M$ Query Analyzer display all numbers as positive, no matter whether they are truly positive or negative ? I am having to cast each column to varchar to find out if there are any...
5
by: Subrahmanyam Arya | last post by:
Hi Folks , I am trying to solve the problem of reading the numbers correctly from a serial line into an intel pentium processor machine . I am reading 1 byte and 2byte data both positive...
1
by: illegal.prime | last post by:
So I see from the documentation here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemCollectionsArrayListClassBinarySearchTopic.asp That the code uses the...
15
by: jaks.maths | last post by:
How to convert negative integer to hexadecimal or octal number? Ex: -568 What is the equivalent hexadecimal and octal number??
11
by: drtimhill | last post by:
I'm just starting out on Python, and am stumped by what appears an oddity in the way negative indices are handled. For example, to get the last character in a string, I can enter "x". To get the...
39
by: Frederick Gotham | last post by:
I have a general idea about how negative number systems work, but I'd appreciate some clarification if anyone would be willing to help me. Let's assume we're working with an 8-Bit signed integer,...
15
by: Ivan Novick | last post by:
Hi, Is it possible to have negative integer literal or only positive? As far as I understand, the code below would be a positive integer literal and the unary negative operator. x = -3.2; ...
23
by: Hallvard B Furuseth | last post by:
As far as I can tell, (x & -1) is nonzero if the integer x is negative zero. So for signed types, x == 0 does not guarantee (x & foo) == 0. Is that right? (Not that I expect to ever encounter a...
8
by: valentin tihomirov | last post by:
My rateonale is: -1 mod 3 = must be 3 0 mod 3 = 0 1 mod 3 = 1 2 mod 3 = 2 3 mod 3 = 3 4 mod 3 = 0 = 1 = 2 = 3
20
by: Casey | last post by:
Is there an easy way to use getopt and still allow negative numbers as args? I can easily write a workaround (pre-process the tail end of the arguments, stripping off any non-options including...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.