473,407 Members | 2,359 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,407 software developers and data experts.

How to round and store negative numbers to zero in a field

547 512MB
I would like to round all negative numbers to zero and save it as "0", in the "OrderQty" field after a formula was used.

The calculation appears in after update event of a field called (me.counts):
Expand|Select|Wrap|Line Numbers
  1. If Not IsNull(Me.IssueAvg) Then
  2. Me.OrderQty = (Nz(Me.IssueAvg) * Nz(Me.OrderFactor)) - (Nz(Me.Counts))
  3. End If
It works but give me negative quantities in some instances

I would like to use something like this to get a zero in the "OrderQty" field if required.
Expand|Select|Wrap|Line Numbers
  1.  IIf([OrderQty]<0,0)
Please assist
May 20 '14 #1

✓ answered by jimatqsi

And why not simply
Expand|Select|Wrap|Line Numbers
  1. if Me.OrderQty<0 then Me.OrderQty=0
?
Or using the IIF function you could use
Expand|Select|Wrap|Line Numbers
  1. iif(me.OrderQty<0,0,ME.OrderQty)
Jim

1 1188
jimatqsi
1,271 Expert 1GB
And why not simply
Expand|Select|Wrap|Line Numbers
  1. if Me.OrderQty<0 then Me.OrderQty=0
?
Or using the IIF function you could use
Expand|Select|Wrap|Line Numbers
  1. iif(me.OrderQty<0,0,ME.OrderQty)
Jim
May 20 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: eddie wang | last post by:
formatcurrency function puts ( ) for negative numbers(e.g. (111) ). How can I display the negative numbers with a minus sign infront like -111. Thanks. *** Sent via Developersdex...
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...
4
by: Charles A. Lackman | last post by:
Hello, I have some textboxes that are doing addition: Dim AString As Double AString = Convert.ToDouble(TextBox1.Text) - Convert.To(DoubleTextBox2.Text) TextBox3.Text =...
4
by: Bob Bryan | last post by:
I am using a select statement to obtain a result set back with aggregated data. The problem is that I am seeing column data with 11 to 13 digits after the decimal point. I tried using the STR...
1
by: Iain West | last post by:
Hi, I have a bit of code which draws a chart up or down from the centre line (zero). When I have negative numbers in MSIE it displays fine and in Mozila it doesn't draw at all. Positve...
11
by: tlyczko | last post by:
Hello Rob B posted this wonderful code in another thread, http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/c84d8538025980dd/6ead9d5e61be85f0#6ead9d5e61be85f0 I could not...
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,...
1
by: twocansam1 | last post by:
I am writing a routine to check for bad or no input, How can I check for blanks or spaces and negative numers?? negative numbers and spaces just cause the program to lock up. They don't get...
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...
2
by: george8000 | last post by:
Ok well i know that isdigit in my code is seeing the negatives as a character and so i made my program give an error message. But i need negative numbers to work how could i get this to work with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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,...

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.