A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Query: Calculating



 
 
Thread Tools Display Modes
  #1  
Old February 25th, 2010, 05:31 PM posted to microsoft.public.access.queries
Boon
external usenet poster
 
Posts: 115
Default Query: Calculating

Hi,

I have a table A. Table A has 2 fields - Sale1 and Sale2. I want to create a
query that will sum the value in Sale1 and Sale2. In the query I wrote ---
Output: [Sale1]+[Sale2]

The problem I have is that if either value in Sale1 or Sale2 is null, the
Output return Null value. But I want it to show the value and treat null as
0. For instance, 5+Null =5.

thanks,
Boon


  #2  
Old February 25th, 2010, 05:51 PM posted to microsoft.public.access.queries
fredg
external usenet poster
 
Posts: 4,386
Default Query: Calculating

On Thu, 25 Feb 2010 11:31:11 -0600, Boon wrote:

Hi,

I have a table A. Table A has 2 fields - Sale1 and Sale2. I want to create a
query that will sum the value in Sale1 and Sale2. In the query I wrote ---
Output: [Sale1]+[Sale2]

The problem I have is that if either value in Sale1 or Sale2 is null, the
Output return Null value. But I want it to show the value and treat null as
0. For instance, 5+Null =5.

thanks,
Boon


Look up the Nz function in VBA help:
Output:Nz([Sale1],0) + Nz([Sale2],0)
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #3  
Old February 25th, 2010, 06:15 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Query: Calculating

Output: Nz([Sale1],0) + Nz([Sale2],0)

--
Build a little, test a little.


"Boon" wrote:

Hi,

I have a table A. Table A has 2 fields - Sale1 and Sale2. I want to create a
query that will sum the value in Sale1 and Sale2. In the query I wrote ---
Output: [Sale1]+[Sale2]

The problem I have is that if either value in Sale1 or Sale2 is null, the
Output return Null value. But I want it to show the value and treat null as
0. For instance, 5+Null =5.

thanks,
Boon


.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:28 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.