PC Review


Reply
Thread Tools Rate Thread

Crosstab Null value display as a "0"

 
 
Leah
Guest
Posts: n/a
 
      7th Jan 2008
My crosstab is built on one feild from a table and the corresponding feild
list table as a left-outer join. The crosstab returns the total by month for
each of the items in the field and if there were no records returns a zero
for a grand total. When I try to add the date field from the first table and
query for a specific time period, I lose all of the items with null values.
I have tried to use the NZ function, but with no luck. Either I am building
the query incorrectly of I have built my crosstab incorrectly. Would someone
please advise.
 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      8th Jan 2008
Presumably the date field is in the table that's on the outer side of the
join. Then the criteria eliminates the nulls, and so the net result is the
same as if you had used an inner join.

If that's what's going on, it might be simplest to split this into 2
queries. Create an ordinary SELECT query that returns the records you want
from the table on the outer side of the join, with the date criteria. Save
this query.

Now create a crosstab that uses this query as an input "table", instead of
the table you currently have. In this new query, use the outer join between
your table and this lower-level query. Since the criteria already operated
before the lower query returned its records, the outer join will work
correctly.

If you need to use parameters for the lower-level query, be sure to declare
them. For example, if you are using a form that has text boxes for StartDate
and EndDate, the criteria might be:
Between [Forms].[Form1].[StartDate] And [Forms].[Form1].[EndDate]
Then in query design (in this lower-level query), choose Parameters on the
Query menu, and enter 2 rows:
[Forms].[Form1].[StartDate] Date/Time
[Forms].[Form1].[EndDate] Date/Time

For other crosstab tricks:
http://allenbrowne.com/ser-67.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Leah" <(E-Mail Removed)> wrote in message
news:E82E8A65-8EA9-431A-AADA-(E-Mail Removed)...
> My crosstab is built on one feild from a table and the corresponding feild
> list table as a left-outer join. The crosstab returns the total by month
> for
> each of the items in the field and if there were no records returns a zero
> for a grand total. When I try to add the date field from the first table
> and
> query for a specific time period, I lose all of the items with null
> values.
> I have tried to use the NZ function, but with no luck. Either I am
> building
> the query incorrectly of I have built my crosstab incorrectly. Would
> someone
> please advise.


 
Reply With Quote
 
Leah
Guest
Posts: n/a
 
      8th Jan 2008
Thank you, I have spent hours trying to figure this out.
Leah

"Allen Browne" wrote:

> Presumably the date field is in the table that's on the outer side of the
> join. Then the criteria eliminates the nulls, and so the net result is the
> same as if you had used an inner join.
>
> If that's what's going on, it might be simplest to split this into 2
> queries. Create an ordinary SELECT query that returns the records you want
> from the table on the outer side of the join, with the date criteria. Save
> this query.
>
> Now create a crosstab that uses this query as an input "table", instead of
> the table you currently have. In this new query, use the outer join between
> your table and this lower-level query. Since the criteria already operated
> before the lower query returned its records, the outer join will work
> correctly.
>
> If you need to use parameters for the lower-level query, be sure to declare
> them. For example, if you are using a form that has text boxes for StartDate
> and EndDate, the criteria might be:
> Between [Forms].[Form1].[StartDate] And [Forms].[Form1].[EndDate]
> Then in query design (in this lower-level query), choose Parameters on the
> Query menu, and enter 2 rows:
> [Forms].[Form1].[StartDate] Date/Time
> [Forms].[Form1].[EndDate] Date/Time
>
> For other crosstab tricks:
> http://allenbrowne.com/ser-67.html
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Leah" <(E-Mail Removed)> wrote in message
> news:E82E8A65-8EA9-431A-AADA-(E-Mail Removed)...
> > My crosstab is built on one feild from a table and the corresponding feild
> > list table as a left-outer join. The crosstab returns the total by month
> > for
> > each of the items in the field and if there were no records returns a zero
> > for a grand total. When I try to add the date field from the first table
> > and
> > query for a specific time period, I lose all of the items with null
> > values.
> > I have tried to use the NZ function, but with no luck. Either I am
> > building
> > the query incorrectly of I have built my crosstab incorrectly. Would
> > someone
> > please advise.

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Add" Can I display numeric zero values in crosstab query reports? Nick Microsoft Access Reports 1 20th Nov 2008 08:45 PM
Pivot Table Form - Display Null Values as "0" on Data Axis? David Saywell Microsoft Access Form Coding 2 11th Mar 2008 08:18 PM
In my crosstab query I want it to enter a "0" for null values. =?Utf-8?B?QW1iZXIxODA1?= Microsoft Access Queries 8 15th Aug 2006 06:37 AM
Display other than "#null!" for divison of Null values =?Utf-8?B?S291IFZhbmc=?= Microsoft Access Reports 5 10th Jan 2006 05:06 PM
Using combo-box as a user filter - trying to use format to display text "all" for null values google@darincline.com Microsoft Access Form Coding 2 3rd Sep 2005 09:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:07 PM.