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  

Getting a null value to display zero in count query



 
 
Thread Tools Display Modes
  #1  
Old July 22nd, 2008, 03:37 PM posted to microsoft.public.access.queries
kahaymon
external usenet poster
 
Posts: 8
Default Getting a null value to display zero in count query

How can I get this query to yield a zero when the count of the field "ID" is
zero?

SELECT [QRY IP Falls U parameter].[Unit location of incident], [QRY IP Falls
U parameter].Shift, Count([QRY IP Falls U parameter].ID) AS [2005 Falls]
FROM [QRY IP Falls U parameter]
WHERE ((([QRY IP Falls U parameter].[Date of incident]) Between #1/1/2005#
And #12/31/2005#))
GROUP BY [QRY IP Falls U parameter].[Unit location of incident], [QRY IP
Falls U parameter].Shift;


Thanks.
  #2  
Old July 22nd, 2008, 10:08 PM posted to microsoft.public.access.queries
Michel Walsh
external usenet poster
 
Posts: 2,404
Default Getting a null value to display zero in count query

Nz(COUNT([QRY IP Falls U parameter].ID), 0)

instead of

Count([QRY IP Falls U parameter].ID)



Vanderghast, Access MVP



"kahaymon" wrote in message
...
How can I get this query to yield a zero when the count of the field "ID"
is
zero?

SELECT [QRY IP Falls U parameter].[Unit location of incident], [QRY IP
Falls
U parameter].Shift, Count([QRY IP Falls U parameter].ID) AS [2005 Falls]
FROM [QRY IP Falls U parameter]
WHERE ((([QRY IP Falls U parameter].[Date of incident]) Between #1/1/2005#
And #12/31/2005#))
GROUP BY [QRY IP Falls U parameter].[Unit location of incident], [QRY IP
Falls U parameter].Shift;


Thanks.



 




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 08:01 PM.


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