Solved

Null Values in Access

Posted on 2012-03-21
5
175 Views
Last Modified: 2012-03-22
I have joined two tables(table1 & employeeinfo) and when i enter the code below, i retrieve the desired results, but now i am trying to remove all rows that have a blank value for the employee name since those staff no longer work for the agency.  Employeename is retrieved from the employeeinfo table.  

I thought all i had to do is Where table1.lastuser Is Not Null AND EmployeeName Is NOT Null, but realized that means both those fields have to be Null to be removed.    

SELECT table1.LastUser, [LAST_NAME] & " " & [FIRST_NAME] AS EmployeeName, employeeinfo.REGION, employeeinfo.DEPTNAME, employeeinfo.JOBTITLE
FROM employeeinfo RIGHT JOIN table1 ON employeeinfo.LOGNAME=table1.LastUser
WHERE (((table1.LastUser) Is Not Null));

I have attached what the query looks like now.  The highlighted fields are the only ones i want to retain.
Building.xls
0
Comment
Question by:jsawicki
  • 3
5 Comments
 
LVL 30

Expert Comment

by:hnasr
ID: 37750887
Try INNER JOIN
0
 
LVL 30

Accepted Solution

by:
hnasr earned 400 total points
ID: 37750898
SELECT table1.LastUser, [LAST_NAME] & " " & [FIRST_NAME] AS EmployeeName, employeeinfo.REGION, employeeinfo.DEPTNAME, employeeinfo.JOBTITLE
FROM employeeinfo INNER JOIN table1 ON employeeinfo.LOGNAME=table1.LastUser
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 37751296
You can use:

IIf(Trim([LAST_NAME] & " " & [FIRST_NAME]) = "", Null, Trim([LAST_NAME] & " " & [FIRST_NAME])) AS EmployeeName,

Then you filter for EmployeeName Is Null.

/gustav
0
 

Author Closing Comment

by:jsawicki
ID: 37754306
Funny how simple that was, thanks.
0
 
LVL 30

Expert Comment

by:hnasr
ID: 37754626
Welcome!
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Auto-generated ID's in MS Access 9 43
sql statement - 9 24
Trying to open FORM in specific record !! 6 44
Obtaining Access 2013 Runtime file for Sagekey 2013 Installer 3 18
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now