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  

Nz - need code -



 
 
Thread Tools Display Modes
  #1  
Old March 9th, 2010, 01:33 AM posted to microsoft.public.access.queries
Bibi
external usenet poster
 
Posts: 54
Default Nz - need code -

I have a crosstab query that yields no value where I need a 0 value for
further calculation.

I do not write code:
This is the SQL for the crosstab.

TRANSFORM Sum(qLeaseEndDataAllDatesStatusJoin.Count) AS SumOfCount
SELECT qLeaseEndDataAllDatesStatusJoin.[Lease Month],
qLeaseEndDataAllDatesStatusJoin.[Lease Year],
Sum(qLeaseEndDataAllDatesStatusJoin.Count) AS [Total Of Count]
FROM qLeaseEndDataAllDatesStatusJoin
GROUP BY qLeaseEndDataAllDatesStatusJoin.[Lease Month],
qLeaseEndDataAllDatesStatusJoin.[Lease Year]
PIVOT qLeaseEndDataAllDatesStatusJoin.Status;

I'm pretty sure I need to add an Nz somewhere - just don't know
where......could someone please help?
--
TIA
Bibi
  #2  
Old March 9th, 2010, 05:12 AM posted to microsoft.public.access.queries
Duane Hookom[_4_]
external usenet poster
 
Posts: 316
Default Nz - need code -

Try:
TRANSFORM Val(Nz(Sum(qLeaseEndDataAllDatesStatusJoin.Count), 0)) AS
SumOfCount
SELECT qLeaseEndDataAllDatesStatusJoin.[Lease Month],
qLeaseEndDataAllDatesStatusJoin.[Lease Year],
Sum(qLeaseEndDataAllDatesStatusJoin.Count) AS [Total Of Count]
FROM qLeaseEndDataAllDatesStatusJoin
GROUP BY qLeaseEndDataAllDatesStatusJoin.[Lease Month],
qLeaseEndDataAllDatesStatusJoin.[Lease Year]
PIVOT qLeaseEndDataAllDatesStatusJoin.Status;

--
Duane Hookom
MS Access MVP

"Bibi" wrote in message
...
I have a crosstab query that yields no value where I need a 0 value for
further calculation.

I do not write code:
This is the SQL for the crosstab.

TRANSFORM Sum(qLeaseEndDataAllDatesStatusJoin.Count) AS SumOfCount
SELECT qLeaseEndDataAllDatesStatusJoin.[Lease Month],
qLeaseEndDataAllDatesStatusJoin.[Lease Year],
Sum(qLeaseEndDataAllDatesStatusJoin.Count) AS [Total Of Count]
FROM qLeaseEndDataAllDatesStatusJoin
GROUP BY qLeaseEndDataAllDatesStatusJoin.[Lease Month],
qLeaseEndDataAllDatesStatusJoin.[Lease Year]
PIVOT qLeaseEndDataAllDatesStatusJoin.Status;

I'm pretty sure I need to add an Nz somewhere - just don't know
where......could someone please help?
--
TIA
Bibi


  #3  
Old March 9th, 2010, 12:21 PM posted to microsoft.public.access.queries
Bibi
external usenet poster
 
Posts: 54
Default Nz - need code -

Thank you so much! I was really struggling with this.

TIA
Bibi


"Duane Hookom" wrote:

Try:
TRANSFORM Val(Nz(Sum(qLeaseEndDataAllDatesStatusJoin.Count), 0)) AS
SumOfCount
SELECT qLeaseEndDataAllDatesStatusJoin.[Lease Month],
qLeaseEndDataAllDatesStatusJoin.[Lease Year],
Sum(qLeaseEndDataAllDatesStatusJoin.Count) AS [Total Of Count]
FROM qLeaseEndDataAllDatesStatusJoin
GROUP BY qLeaseEndDataAllDatesStatusJoin.[Lease Month],
qLeaseEndDataAllDatesStatusJoin.[Lease Year]
PIVOT qLeaseEndDataAllDatesStatusJoin.Status;

--
Duane Hookom
MS Access MVP

"Bibi" wrote in message
...
I have a crosstab query that yields no value where I need a 0 value for
further calculation.

I do not write code:
This is the SQL for the crosstab.

TRANSFORM Sum(qLeaseEndDataAllDatesStatusJoin.Count) AS SumOfCount
SELECT qLeaseEndDataAllDatesStatusJoin.[Lease Month],
qLeaseEndDataAllDatesStatusJoin.[Lease Year],
Sum(qLeaseEndDataAllDatesStatusJoin.Count) AS [Total Of Count]
FROM qLeaseEndDataAllDatesStatusJoin
GROUP BY qLeaseEndDataAllDatesStatusJoin.[Lease Month],
qLeaseEndDataAllDatesStatusJoin.[Lease Year]
PIVOT qLeaseEndDataAllDatesStatusJoin.Status;

I'm pretty sure I need to add an Nz somewhere - just don't know
where......could someone please help?
--
TIA
Bibi


 




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 06:56 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.