Results 1 to 5 of 5
  1. #1
    Ron_PTC is offline Novice
    Windows 8 Access 2007
    Join Date
    Oct 2015
    Posts
    7

    Query with Is Null returning results with values

    I created a query that would determine who our current employees are.

    Click image for larger version. 

Name:	Query1.jpg 
Views:	7 
Size:	81.1 KB 
ID:	22384



    The result of TermDate - Criteria: Is Null

    Click image for larger version. 

Name:	QueryResults.jpg 
Views:	7 
Size:	89.4 KB 
ID:	22387

    Jesse clearly has a TermDate. Other employees listed in the tblEmployees with a TermDate value do not populate when the query is run. In an effort to remove Jesse from the list, I tried adding a second layer to catch him -- thus the Voluntary and Involuntary fields in the query. In the query I set the Criteria for Voluntary to No. I did the same for Involuntary. Jesse is still hanging around. Please help me get rid of Jesse.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    It would be easier if you posted the SQL of the query.
    Go to sql view and copy the code.

  3. #3
    Ron_PTC is offline Novice
    Windows 8 Access 2007
    Join Date
    Oct 2015
    Posts
    7
    Here you go:

    SELECT tblEmployees.TermDate, tblEmployees.FirstName, tblEmployees.Voluntary, tblEmployees.Involuntary
    FROM tblEmployees
    WHERE (((tblEmployees.TermDate) Is Null) AND ((tblEmployees.Company) Like "PTC/DEC*") AND ((tblEmployees.Voluntary)=No) AND ((tblEmployees.Involuntary)=No)) OR (((tblEmployees.Company) Like "CH/DEC*"));

  4. #4
    Ron_PTC is offline Novice
    Windows 8 Access 2007
    Join Date
    Oct 2015
    Posts
    7
    Got it once I saw it written out. Looks like the criteria applied to the first company sort (like "PTC/DEC*) and not the second sort (like "CH/DEC*)

    Thanks

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Glad you have it working.

    Here is a different view of the SQL
    Code:
    SELECT tblEmployees.TermDate
    	,tblEmployees.FirstName
    	,tblEmployees.Voluntary
    	,tblEmployees.Involuntary
    FROM tblEmployees
    WHERE (
    		((tblEmployees.TermDate) IS NULL)
    		AND ((tblEmployees.Company) LIKE "PTC/DEC*")
    		AND ((tblEmployees.Voluntary) = No)
    		AND ((tblEmployees.Involuntary) = No)
    		)
    	OR (((tblEmployees.Company) LIKE "CH/DEC*"));
    This layout helps see things.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 04-15-2015, 10:52 AM
  2. Replies: 24
    Last Post: 04-08-2015, 02:59 PM
  3. Outer join not returning null values.
    By Count Duckula in forum Queries
    Replies: 3
    Last Post: 08-15-2013, 10:03 AM
  4. Query Not Returning Null Fields
    By mgmirvine in forum Queries
    Replies: 2
    Last Post: 10-28-2011, 06:15 PM
  5. Query not returning null values
    By janelgirl in forum Access
    Replies: 5
    Last Post: 10-11-2011, 10:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums