Solved

How exclude record in query if two fields are null

Posted on 2014-07-28
3
938 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 119

Accepted Solution

by:
Rey Obrero 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

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…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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…

912 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