473,795 Members | 3,002 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Crosstab report Null and Zeros

Hello,

I made a report from a crosstab query following the steps onlined in
MSDN's Solutions.mdb example. I now have a dynamic crosstab report
(great!), but with one minor problem. I cannot get access to show NULL
and 0 values seperately. I've tried the following Format properties in
my text box:

0.0;;0;"" --> Both NULL and 0 values display as 0
0.0;;"";"" --> Both NULL and 0 values show up blank

What I want to happen is if a 0 is entered into the database, for it to
appear as 0 (or 0.0), while if no data is entered into the field, it
shows up blank.

Any suggestions? Duane - are you out there, you seem to have lots of
answers :)

Thanks,
JK

Nov 13 '05 #1
12 6651
I'm not Duane, but you should see Null as Null without anything in the
Format property, or with the Format set to General Number.

What is the source of these numbers? For example, if the Value in the
crosstab is a Count of something, the count could return a zero where there
are no matches.

--
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.

<jk*****@gmail. com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Hello,

I made a report from a crosstab query following the steps onlined in
MSDN's Solutions.mdb example. I now have a dynamic crosstab report
(great!), but with one minor problem. I cannot get access to show NULL
and 0 values seperately. I've tried the following Format properties in
my text box:

0.0;;0;"" --> Both NULL and 0 values display as 0
0.0;;"";"" --> Both NULL and 0 values show up blank

What I want to happen is if a 0 is entered into the database, for it to
appear as 0 (or 0.0), while if no data is entered into the field, it
shows up blank.

Any suggestions? Duane - are you out there, you seem to have lots of
answers :)

Thanks,
JK

Nov 13 '05 #2
You're right. When I don't set anything in the format property, Null
is Null. BUT, 0 also appears as NULL. Sorry, forgot to mention that
in the first one. The source for the report is below:

TRANSFORM Max(qryFinalChe ckMarks.Student Mark) AS MaxOfStudentMar k
SELECT [tblTeacher].[FirstName] & " " & [tblTeacher].[LastName] AS
Teacher, UCase([tblStudent].[LastName]) & " " &
[tblStudent].[FirstName] AS Student, qryFinalCheckMa rks.CurrYear
FROM qryFinalCheckMa rks
GROUP BY [tblTeacher].[FirstName] & " " & [tblTeacher].[LastName],
UCase([tblStudent].[LastName]) & " " & [tblStudent].[FirstName],
qryFinalCheckMa rks.CurrYear
ORDER BY [tblTeacher].[FirstName] & " " & [tblTeacher].[LastName],
UCase([tblStudent].[LastName]) & " " & [tblStudent].[FirstName]
PIVOT [AssName] & " (/" & [TotalMarks] & ")";

I don't use Max for any particular reason though. It could be any
function as I'm not doing any calculation.

Thanks,
JK

Nov 13 '05 #3
I'm confused.

If the student has no marks at all, the query returns Null.
If the highest mark the student got was a zero, the query returns zero.

In the report based on this query, you will therefore get a zero if that was
the student's highest mark, or a null if the value does not apply. You
therefore have both nulls and zeros in the report, and that's what you say
you want.

--
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.
<jk*****@gmail. com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
You're right. When I don't set anything in the format property, Null
is Null. BUT, 0 also appears as NULL. Sorry, forgot to mention that
in the first one. The source for the report is below:

TRANSFORM Max(qryFinalChe ckMarks.Student Mark) AS MaxOfStudentMar k
SELECT [tblTeacher].[FirstName] & " " & [tblTeacher].[LastName] AS
Teacher, UCase([tblStudent].[LastName]) & " " &
[tblStudent].[FirstName] AS Student, qryFinalCheckMa rks.CurrYear
FROM qryFinalCheckMa rks
GROUP BY [tblTeacher].[FirstName] & " " & [tblTeacher].[LastName],
UCase([tblStudent].[LastName]) & " " & [tblStudent].[FirstName],
qryFinalCheckMa rks.CurrYear
ORDER BY [tblTeacher].[FirstName] & " " & [tblTeacher].[LastName],
UCase([tblStudent].[LastName]) & " " & [tblStudent].[FirstName]
PIVOT [AssName] & " (/" & [TotalMarks] & ")";

I don't use Max for any particular reason though. It could be any
function as I'm not doing any calculation.

Thanks,
JK

Nov 13 '05 #4
Allen,

Sorry, maybe I'm not explaining this well:

What I want:

1.) If there is no mark entered (Null), I want a blank space to appear
in the report.
2.) If the student received a zero (0) as a mark, I want the zero to be
displayed in the report.

I've tried the following text box formats:

- (nothing - default) - the problem with this is that Null values show
up as zeros in the report.
- 0.0;;0;"" - the problem with this is that Null values show up as
zeros in the report.
- 0.0;;"";"" - the problem with this is that if a student receieved a
0, it shows up blank on the report.
- 0.0;;;"" - the problem with this is that Null values show up as zeros
in the report.

Does that makes sense? I've also tried using First, Last, Min, Max,
and Sum functions in my crosstab query with all of these Format
scenerios, with no avail.

Any suggestions?

Thanks,
JK

Nov 13 '05 #5
I think you are looking in the wrong place to solve this by looking at the
text boxes in the report.

What does the query return: Null or Zero? If it does not return both in the
right places, you will not be able to fix it up later in the report.
Therefore the solution lies in the query, not the report.

It's a bit hard to advise beyond that, as the query you posted is itself
based on data returned from another query, but check out what the query
returns.

--
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.

<jk*****@gmail. com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
Allen,

Sorry, maybe I'm not explaining this well:

What I want:

1.) If there is no mark entered (Null), I want a blank space to appear
in the report.
2.) If the student received a zero (0) as a mark, I want the zero to be
displayed in the report.

I've tried the following text box formats:

- (nothing - default) - the problem with this is that Null values show
up as zeros in the report.
- 0.0;;0;"" - the problem with this is that Null values show up as
zeros in the report.
- 0.0;;"";"" - the problem with this is that if a student receieved a
0, it shows up blank on the report.
- 0.0;;;"" - the problem with this is that Null values show up as zeros
in the report.

Does that makes sense? I've also tried using First, Last, Min, Max,
and Sum functions in my crosstab query with all of these Format
scenerios, with no avail.

Any suggestions?

Thanks,
JK

Nov 13 '05 #6
My query returns (or at least appears to return) Nulls in the fields
with no data. Is there a way that I can test to see if a blank field
is really Null?

When I run the crosstab query mentioned above, it is querying a query
(qryFinalCheckM arks) that is getting a subset of all the marks (only
those for semester 2 - this is a school database). The crosstab query
then grabs all the assignments that are listed for semester 2 and
displays them against the Teacher and Student.

Thanks for your help in troubleshooting .

JK

Nov 13 '05 #7
Temporarily add a text box to your report, with this control source:
=TypeName([MaxOfStudentMar k].Value)

That should indicate if the value is null, or is being treated as a string
or as some kind of number.

You could test specifically for null with:
=IsNull([MaxOfStudentMar k].Value)

--
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.

<jk*****@gmail. com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
My query returns (or at least appears to return) Nulls in the fields
with no data. Is there a way that I can test to see if a blank field
is really Null?

When I run the crosstab query mentioned above, it is querying a query
(qryFinalCheckM arks) that is getting a subset of all the marks (only
those for semester 2 - this is a school database). The crosstab query
then grabs all the assignments that are listed for semester 2 and
displays them against the Teacher and Student.

Thanks for your help in troubleshooting .

JK

Nov 13 '05 #8
Allen,

When I added a textbox to the report with:

=TypeName([MaxOfStudentMar k].[Value])

as the control source, I saw the results as "Single" for every record
that had a number entered into the database (including if a 0 was
entered), and "Null" for the records that did not. These "Nulls" still
appear as "0" in the report though.

Any additional suggestions?

Thanks in advance,
JK

Nov 13 '05 #9
So the report tells us that some records do contain a Null, but the text
boxes still show a zero?

Try setting the Format of the text box to:
General Number

If there were a bad Format set on the field in the table, the report might
be using it. Also, make sure that the Name AutoCorrect boxes are unchecked
under:
Tools | Options | General
and then compact the database to get rid of this junk:
Tools | Database Utilities | Compact
(This could solve the problem if Access is mis-identifying the field with
some previously used name.)

--
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.

<jk*****@gmail. com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
Allen,

When I added a textbox to the report with:

=TypeName([MaxOfStudentMar k].[Value])

as the control source, I saw the results as "Single" for every record
that had a number entered into the database (including if a 0 was
entered), and "Null" for the records that did not. These "Nulls" still
appear as "0" in the report though.

Any additional suggestions?

Thanks in advance,
JK

Nov 14 '05 #10

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

Similar topics

6
8689
by: Dave | last post by:
I came across an article in SQL Mag about Crosstab Queries. It works great in Query Analyzer, but I'm stuck on how to use it in an Access ADP. I need to use it as a Recordsource in a form and report. Can someone tell me how to use it, and please try to be as descriptive as possible. I'm new to Stored Procedures. Thanks *****************************************
3
11494
by: John | last post by:
I've read several prior posts in this group about using nz() to convert null values to zero; however, I'm not sure how/where to implement this function in my crosstab query. The crosstab query (qryPromoFilm_NetCM_Crosstab) uses another query (qryPromo_NetCM) as its source. The crosstab is used to show revenue spread out through the twelve months. I need the months with null values to have a "0" value. This is the SQL for the crosstab...
1
17677
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to Create a Dynamic Crosstab Report PRODUCT :Microsoft Access PROD/VER:1.00 1.10 OPER/SYS:WINDOWS
1
1316
by: jb | last post by:
Query Help Please- I want to make: name date value lee sept 40 lee oct 27 lee nov 50 dan dec 50 jen jan 30
2
2945
by: deejayquai | last post by:
Hi I'm trying to produce a report based on a dynamic crosstab. Ultimately i'd like the report to actually become a sub report within a student end of year record of achievement. The dynamic sub-report will capture what grades the student has achieved in a list of different subjects and the reason I need it to be dynamic is that students take different subjects. Basically I've been trying to doctor the KB article on dynamic
1
4111
by: bobykim | last post by:
Hi All, I'm using MS Access 2003 in a Windows XP environment. I've created an aging report for my department that is based on what I call the "Main query" with an IIf statement that allows the user to define the dates into 30 day aging segments. Then I've created a crosstab query which counts the results. How I'd like the report to appear is like this: Entity_Type | 1 to 30 days | 31 to 60 days | Over 60 days OPFACT ...
23
2564
by: helm | last post by:
Folks, could anyone advise ... Is there a significant difference in crosstab capabilities in Access and Excel? Using Office XP 2002 ... to produce a crosstab report I developed it in Excel from a query datasource in Access. One good thing about this was the ability to select both a date header and then a specific time header for the crosstab value. Try as I might, I cannot see a way to replicate this in Access either directly using a...
3
1446
kcdoell
by: kcdoell | last post by:
Hello Everyone: I have a table called “tblStaticAllForecast”, below are the fields I am currently focusing on within the table: LOB GWP FWeek Any given LOB can have a GWP and FWEEK assigned to it. For example:
14
7861
ollyb303
by: ollyb303 | last post by:
Hi, I am trying to create a dynamic crosstab report which will display number of calls handled (I work for a call centre) per day grouped by supervisor. I have one crosstab query (Query1) which has the following fields: SPID (supervisor ID), total:group by, as row heading Date, total:group by, as column heading Calls handled, total:sum, as value Date, total:where, criteria between and - this is taken from a form,
0
9672
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10439
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9043
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.