473,796 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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)<>'Depl oyed'))
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 7309
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.Group Name, tlkpRegion.Regi onName,
Count(tblCIMCus tomer.CIMID) AS Sales
FROM (tblCIMCustomer LEFT JOIN tlkpGroup ON tblCIMCustomer. GroupID =
tlkpGroup.Group ID) LEFT JOIN tlkpRegion ON tblCIMCustomer. RegionID =
tlkpRegion.Regi onID
WHERE (((tblCIMCustom er.SalesPresent ation)='Complet ed') AND
((tblCIMCustome r.Status)<>'Dep loyed'))
GROUP BY tlkpGroup.Group Name, tlkpRegion.Regi onName;

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
10411
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 is not much help here either. Googling has given me a little help. This is my current understanding -- I would appreciate any comments or corrections... "" -- this means an empty string when applied to String data type, and also to Variant...
18
3352
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 columns, "scode" and "sname", as 1 column (if not possible then 2 columns will be fine) in the listbox. Can the listbox display 2 columns information from the dataset and how can I do that? Also, I set the property of the listbox to selectionmode...
1
2106
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" runat="server"> <INPUT id="UploadedImageFile" runat=server type="file" size="86"> </form>
8
16345
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
5247
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 database and display it in a Image web control dynamically(at runtime). The process after being displayed in the web control, user click insert/add button, it converts the image(jpeg) file to bytes and store it the database with Image or VarBinary...
2
1723
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 it. But there is a problem i have to display Product features as Bulleted lines. Please consider this sample value:
1
4955
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: http://munich.schwarz-interactive.de/autocomplete.aspx
0
1372
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 View)This is done. on clicking this button(ProcPaymBTM_Click) on (Detail View) all selected (checked) data columns needs displayed on another page (Review Data) In this page i click confirm payment button to insert selected data to the SQL Tables. I...
4
9618
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 second value as null. How can i pass two parameters from display:table to next jsp page? i am using default(request) scope to populate values from bean Please help me out to reslove this issue. Thanks Naveen
0
9680
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
9528
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,...
1
10174
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
10012
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9052
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
5442
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
5575
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2926
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.