473,386 Members | 1,699 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,386 software developers and data experts.

Converting Null to Zero for Sum Field not working

Hello,

I'm having this problem and tried the answer in this post:
http://groups.google.com/group/comp....08c90cac4328ff

However, when I build the expression I get an error message that I
have the wrong number of arguments. Can someone tell me what is wrong
with this code?:

TotalOpenOrders: IIf(IsNull(Sum([OpenOrders:Widget]!
[SalesOrderLineAmount]), "0", Sum([OpenOrders:Widget]!
[SalesOrderLineAmount]))

Thanks!
Jun 27 '08 #1
6 11633
Brett Barry: Go Get Geek! wrote:
Hello,

I'm having this problem and tried the answer in this post:
http://groups.google.com/group/comp....08c90cac4328ff

However, when I build the expression I get an error message that I
have the wrong number of arguments. Can someone tell me what is wrong
with this code?:

TotalOpenOrders: IIf(IsNull(Sum([OpenOrders:Widget]!
[SalesOrderLineAmount]), "0", Sum([OpenOrders:Widget]!
[SalesOrderLineAmount]))

Thanks!
Don't know.

Wouldn't
TotalOpenOrders:NZ(Sum(SalesOrderLineAmount),0)
work just as well...or better?

Jun 27 '08 #2
I forgot to add that I tried just doing the Null function because if I
don't, I get blanks on my report in Access 2007, unless a better way
of doing this is suggested. However, when I build the following
expression, the result is converted to a text field, and is no longer
a number field (which I need on the report).

TotalOpenOrders: Nz(Sum([OpenOrders:Widget]!
[SalesOrderLineAmount]),"0")

Is there a way to just control the entire report to convert blanks to
"0.00" instead of having to modify every single query to test for
nulls?

Thanks!
Jun 27 '08 #3
On Jun 18, 12:12*am, "Brett Barry: Go Get Geek!"
<brettcba...@gmail.comwrote:
I forgot to add that I tried just doing the Null function because if I
don't, I get blanks on my report in Access 2007, unless a better way
of doing this is suggested. However, when I build the following
expression, the result is converted to a text field, and is no longer
a number field (which I need on the report).

TotalOpenOrders: Nz(Sum([OpenOrders:Widget]!
[SalesOrderLineAmount]),"0")

Is there a way to just control the entire report to convert blanks to
"0.00" instead of having to modify every single query to test for
nulls?

Thanks!
1) use nz(x, 0), not nz(x, "0") and you'll have a numeric value

2) on the report field, there's a property called 'format' that allows
you to deal with nulls, and print them as 0, just hit F1 for help
Jun 27 '08 #4

1) use nz(x, 0), not nz(x, "0") and you'll have a numeric value

2) on the report field, there's a property called 'format' that allows
you to deal with nulls, and print them as 0, just hit F1 for help

1) Even without the quotes, I get a text field, not numeric. The
"number" is then left aligned in the query result.

2) Can you please give me more detail? I'm using Access 2007 and when
I searched on the keywords, I didn't get anything close to what you
suggested.

Thanks!
Jun 27 '08 #5
On Jun 18, 10:29*am, "Brett Barry: Go Get Geek!"
<brettcba...@gmail.comwrote:
1) use nz(x, 0), not nz(x, "0") and you'll have a numeric value
2) on the report field, there's a property called 'format' that allows
you to deal with nulls, and print them as 0, just hit F1 for help

1) Even without the quotes, I get a text field, not numeric. The
"number" is then left aligned in the query result.

2) Can you please give me more detail? I'm using Access 2007 and when
I searched on the keywords, I didn't get anything close to what you
suggested.

Thanks!
I don't have access2007, but if you open the report, highlight a
field, show properties
you should have a 'format' property
click in it and hit f1 for help
Jun 27 '08 #6
I don't have access2007, but if you open the report, highlight a
field, show properties
you should have a 'format' property
click in it and hit f1 for help
Roger,

Thank you: that helped me out TREMENDOUSLY!

I changed the format to:

0.00;0.00;0.00;0.00

From Access help:
First The format for positive numbers.
Second The format for negative numbers.
Third The format for zero values.
Fourth The format for Null (Null: A value you can enter in a field or
use in expressions or queries to indicate missing or unknown data.
Jun 27 '08 #7

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

Similar topics

15
by: Bushido Hacks | last post by:
Hey c.l.c++ and/or c.g.a.opengl posters, How do I convert a hexidecimal string, traditionally used for defining colors with HTML, into a floating point array? In other words, how do I convert...
6
by: AAVF | last post by:
Hi We have a problem with a query. An Access database links via ODBC to a UNIX server. To speed things, we use the ODBC to load the relevant tables to the local PC that runs Access so that...
8
by: Lyn | last post by:
I am trying to get my head around the concept of default, special or empty values that appear in Access VBA, depending on data type. The Access Help is not much (help), and the manual that I have...
102
by: junky_fellow | last post by:
Can 0x0 be a valid virtual address in the address space of an application ? If it is valid, then the location pointed by a NULL pointer is also valid and application should not receive "SIGSEGV"...
7
by: Dan | last post by:
I'm fairly new to C# and I am having some problems understanding int variables and null values. I have created a class that populates the values of it's fields from a DataReader in it's...
5
by: Brian Robbins | last post by:
In standard C/C++ SDK, MFC, or VCL if I wanted to make a TextBox (CEditBox, TEditBox, etc.) only except numbers I have dozens of ways to handle it. But none of those methods are working in...
5
by: Paolo | last post by:
We are experiencing a problem with COleDateTime while migrating our MFC&ATL project from VC++6.0 to VC++7.1 (Visual Studio .NET 2003). COleDateTime has a DATE conversion operator that in 7.1 asserts...
3
by: Joćo Roberto Alonso | last post by:
Hi I wanto to know if there is a way to convert a DBNull.Value to Decimal and returns to me Decimal.Zero? Examples COLUMN1 = NULL from DB Ex1.: cstr((dt.rows(0).item("COLUMN1"))
7
tdw
by: tdw | last post by:
Hi all, I've tried to find this answer in the help menu and online but haven't found it: When I type in a field on my form, and then hit backspace to erase what I just typed, my understanding...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.