473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Display Null Values - Please Help

Hello Everyone,
I have scoured through a million messages (ok...thats a bit
exaggerated) but I just cannot figure out how to display null values in
a query. I have tried Nz, IIF, Count(*) but it just does not work. I
hope someone can help me with this. Here are the details:

Table: Group
Fields: Group Name, Group ID

Table: Region
Fields Region Name, Region ID

Table: CIM Customer Table
Fields: Group Name, Region Name, Sales Presentation, Status

Objective: Get a count for each Group (3 groups in total) and each
Region (3 Regions each for each group) where Status <> 'Deployed' and
Sales Presentation = 'Complete'

I get the count, but it does not include those regions/groups where the
field is null. I like it to display a zero for nulls. Here is the SQL
that I am currently using:

SELECT [cim customer table].Group, [cim customer table].Region,
Count(*) AS SALES
FROM [cim customer table]
WHERE ((([cim customer table].[Sales Presentation])='Completed') AND
(([cim customer table].Status)<>'Deployed'))
GROUP BY [cim customer table].Group, [cim customer table].Region;

I tried using the group and region tables as against the group and
region fields in the customer table but it wouldn't work.

Pleae Help

Thanks

Mar 31 '06 #1
4 7290
Dennis,

First, Access will always display Null fields in a query if they are
there. However, if what you are after is to display records from a
table that is linked to a second table but has records that do not
match, that is an outer join. To create an outer join in Access, you
click on the line in the query window and right-click the line to get
to the link properties and select that you would want to see all the
records from the cim customer table and any records from the region or
group table that match.

Going back to your example, you have several issues going on. Based on
the way you set up the tables, I would think you were planning on using
the Region and Group tables as lookups. But in the CIM Customer table
you are using the Region Name and Group Name fields instead of the
Group ID and Region ID fields. You would usually have the id fields in
the parent table, link them to the lookup tables, and then use the
outer joins in the query to allow you to show the name if it is there
and a blank or null if not.

Susan Kennedy

Mar 31 '06 #2
Dennis,

First, Access will always display Null fields in a query if they are
there. However, if what you are after is to display records from a
table that is linked to a second table but has records that do not
match, that is an outer join. To create an outer join in Access, you
click on the line in the query window and right-click the line to get
to the link properties and select that you would want to see all the
records from the cim customer table and any records from the region or
group table that match.

Going back to your example, you have several issues going on. Based on
the way you set up the tables, I would think you were planning on using
the Region and Group tables as lookups. But in the CIM Customer table
you are using the Region Name and Group Name fields instead of the
Group ID and Region ID fields. You would usually have the id fields in
the parent table, link them to the lookup tables, and then use the
outer joins in the query to allow you to show the name if it is there
and a blank or null if not.

Susan Kennedy

Mar 31 '06 #3
Susan,

Thanks for your quick response. I can fix the table such that it is
setup in the following fashion:

Table: Group
Fields: Group Name, Group ID

Table: Region
Fields Region Name, Region ID

Table: CIM Customer Table
Fields: Group ID, Region ID, Sales Presentation, Status

I tried the outer join but it gave me an error. Any ideas on what the
SQL will be for that. I am new to Access and so I'm sorry if my
questions are basic.

Thanks

Dennis

Mar 31 '06 #4
SELECT tlkpGroup.GroupName, tlkpRegion.RegionName,
Count(tblCIMCustomer.CIMID) AS Sales
FROM (tblCIMCustomer LEFT JOIN tlkpGroup ON tblCIMCustomer.GroupID =
tlkpGroup.GroupID) LEFT JOIN tlkpRegion ON tblCIMCustomer.RegionID =
tlkpRegion.RegionID
WHERE (((tblCIMCustomer.SalesPresentation)='Completed') AND
((tblCIMCustomer.Status)<>'Deployed'))
GROUP BY tlkpGroup.GroupName, tlkpRegion.RegionName;

Notice that I would not name a table Group or Region. I believe
strongly in naming conventions, but even if you don't use anything,
Group is a reserved word and will cause you problems later.

Susan

Mar 31 '06 #5

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

Similar topics

8
by: Lyn | last post by:
I am trying to get my head around the concept of default, special or empty values that appear in Access VBA, depending on data type. The Access Help is not much (help), and the manual that I have...
18
by: Alpha | last post by:
Hi, I'm working on a Windows applicaton with VS 2003 on windows 2000. I have a listbox that I have binded to a dataset table, "source" which has 3 columns. I would like to display 2 of those...
1
by: Adam | last post by:
I am having difficulty retrieving images from a SQL database. Here is the code I use to UPLOAD the image to the database: <form id="Form1" method="post" enctype="multipart/form-data"...
8
by: sweetpotatop | last post by:
Hello, I would like to query the top 5 best companies' sales (total sales), then total the rest, what is the quickest and effective SQL to query it? Thanks in advance
3
by: den 2005 | last post by:
Hi everyone, Here is code working on..Trying to insert record with a column with Image or VarBinary datatype in sql database from a existing jpeg image file, then retrieve this image from...
2
ak1dnar
by: ak1dnar | last post by:
CREATE TABLE `products` ( `p_id` int(11) NOT NULL, `p_name` varchar(15) default NULL, `p_features` varchar(100) default NULL ) from this table I am going to fetch the records and display...
1
by: Bob | last post by:
Hi, Hope you can help me with this one. I'm at my wits end. I'm trying to create an intelligent edit-box like the excellent "Customer" one at the URL: ...
0
by: svgeorge | last post by:
I have web pages for making several 9 type of payments. The data gets loaded on web page from SQL server 2005 database. Then I have Process payment button(ProcPaymBTM_Click) on the web page(Detail...
4
by: naveenkongati | last post by:
Hi, I am using Displaytag to populate values on Jsp page using(display:column).If I want to pass two values from this page to next jsp page with href & paramID , i am only getting one value and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.