Null values being incorrectly excluded

JH40

Registered User.
Local time
Today, 12:35
Joined
Sep 16, 2010
Messages
100
My query is excluding null values in error. Can someone assist me in where my code error is? I have one table I'm querying from and using two fields to filter. Here is the statement that is excluding the two discharge disposition types, but is also excluding all null values:

WHERE
(((tbl_finaloutput.[Discharge Disposition])<>"Admit-Inpatient"
Or (tbl_finaloutput.[Discharge Disposition])<>"PVH Inpt/Outpt")
AND ((tbl_finaloutput.[Patient Type])="er"

I want to make sure I return all Null values in the Discharge Disposition field. For example, there may be another record where the patient type is "er" but the discharge disposition field is blank--this should be in the result because it's an "er" record. I know that I need to define that null values should be recognized as valid, but not sure how... Thank you!
 
lookup the NZ function, or inlude an " OR MySpecificValue IS NULL on your criteria "
 
This should be your WHERE clause:

WHERE ((tbl_finaloutput.[Discharge Disposition]<>"Admit-Inpatient") AND (tbl_finaloutput.[Discharge Disposition]<>"PVH Inpt/Outpt")) OR (tbl_finaloutput.[Patient Type]="er")
 
I tried the expression above, but unfortunately, it excludes all records. I also studied and tried the Nz function but that is not working either. I believe what I earlier referred to as NULL should have been EMPTY. What would you all suggest for that? I tried:

<>Nz("Admit-Inpatient") or Nz("PVH Inpt/Outpt")

But the rows with an empty cell still get excluded...
 
In your query, put Is Null in the OR row under Discharge Disposition and Patient Type fields.
 

Users who are viewing this thread

Back
Top Bottom