Solved

How exclude record in query if two fields are null

Posted on 2014-07-28
3
973 Views
Last Modified: 2014-07-28
I have a query that includes to fields, for example...  Date1 and Date2

If either of these date fields have a date in them I want the record to be included in the query result.  But if BOTH of the date fields are null I do not want the record to be included in the result.

How can this be done?
0
Comment
Question by:SteveL13
3 Comments
 
LVL 21

Expert Comment

by:Randy Poole
ID: 40224330
select * from yourtable where not isNull(Date1) or not isNull(Date2)
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40224335
add a Where clause

WHERE ((DATE1 Is Not Null) AND (DATE2 Is Not Null)) OR ((DATE1 Is Not Null)) OR ((DATE2 Is Not Null))
0
 
LVL 33

Expert Comment

by:ste5an
ID: 40224336
Add an appropriate WHERE condition. E.g.
WHERE NOT (IsNull([Date1]) AND IsNull([Date2]))

Open in new window

.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

839 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