473,395 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

is null not working for date/time

I have a Access 97 query that has in its where clause:

And ((tbl_01_LoanData.PayOffDate) Is Null)

Upon execution, all records returned have no PayOffDate except 1. When
I include PayOffDate in the select list one record shows a date of
'12/16/2005' - clearly not a null value. Shouldn't the above code
filter this out? Many thanks!

-Jeff

Mar 16 '06 #1
4 5196
Yes, it should filter it out, though there could be something else in the
WHERE clause that is affecting it.

For example, if you have:
WHERE (Company Is Null) OR (Amount > 0 AND PayOffDate Is Null)
any record where the Company field is null will be returned, regardless of
the date. That's becuase of the way the OR and AND are bracketed.

In summary:
A OR (B AND C)
is not the same as:
(A OR B) AND C

If that is not what is happening, try a repair on your database. If the
PayOffDate field is indexed, a corrupt index can give the symptoms you
describe.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<jn********@gmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
I have a Access 97 query that has in its where clause:

And ((tbl_01_LoanData.PayOffDate) Is Null)

Upon execution, all records returned have no PayOffDate except 1. When
I include PayOffDate in the select list one record shows a date of
'12/16/2005' - clearly not a null value. Shouldn't the above code
filter this out? Many thanks!

-Jeff

Mar 16 '06 #2
By chance is that record the last one? If so, could it be that what you're
seeing is the DefaultValue for the field in the row for a new record?

--
Wayne Morgan
MS Access MVP
<jn********@gmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
I have a Access 97 query that has in its where clause:

And ((tbl_01_LoanData.PayOffDate) Is Null)

Upon execution, all records returned have no PayOffDate except 1. When
I include PayOffDate in the select list one record shows a date of
'12/16/2005' - clearly not a null value. Shouldn't the above code
filter this out? Many thanks!

-Jeff

Mar 16 '06 #3
The full query is as follows:

SELECT tbl_01_LoanData.LoanNumber, [tbl_01_LoanData]![BorrowerLast] &
', ' & [tbl_01_LoanData]![BorrowerFirst] AS Borrower,
tbl_01_LoanData.NoteAmount, tbl_01_LoanData.InvestorCompany,
tbl_01_LoanData.ClosingDate, tbl_01_LoanData.DisbursementDate,
tbl_01_LoanData.LesserAmount, tbl_01_LoanData.PayOffDate
FROM tbl_01_LoanData
WHERE (((tbl_01_LoanData.ClosingDate) Is Not Null) And
((tbl_01_LoanData.DisbursementDate) <=#3/16/2006#) And
((tbl_01_LoanData.LoanType) = 'Warehouse') And
((tbl_01_LoanData.PayOffDate) Is Null) And
((tbl_01_LoanData.LoanStatus) = 'In Process'))
ORDER BY tbl_01_LoanData.DisbursementDate;
The corrupt database diagnosis could be correct. The offending record
does meet all of the other criteria in the where clause, but the null
check for PayOffDate should filter it out.

Mar 16 '06 #4
The logic of the WHERE clause appears correct. Assuming you're not just
mistaking the default value in the new record, then I would go with Allen's
suggestion of a corrupt index. When you do a Compact and Repair, it will
redo the indexes. See if that solves the problem.

--
Wayne Morgan
MS Access MVP
<jn********@gmail.com> wrote in message
news:11**********************@j52g2000cwj.googlegr oups.com...
The full query is as follows:

SELECT tbl_01_LoanData.LoanNumber, [tbl_01_LoanData]![BorrowerLast] &
', ' & [tbl_01_LoanData]![BorrowerFirst] AS Borrower,
tbl_01_LoanData.NoteAmount, tbl_01_LoanData.InvestorCompany,
tbl_01_LoanData.ClosingDate, tbl_01_LoanData.DisbursementDate,
tbl_01_LoanData.LesserAmount, tbl_01_LoanData.PayOffDate
FROM tbl_01_LoanData
WHERE (((tbl_01_LoanData.ClosingDate) Is Not Null) And
((tbl_01_LoanData.DisbursementDate) <=#3/16/2006#) And
((tbl_01_LoanData.LoanType) = 'Warehouse') And
((tbl_01_LoanData.PayOffDate) Is Null) And
((tbl_01_LoanData.LoanStatus) = 'In Process'))
ORDER BY tbl_01_LoanData.DisbursementDate;
The corrupt database diagnosis could be correct. The offending record
does meet all of the other criteria in the where clause, but the null
check for PayOffDate should filter it out.

Mar 17 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Kris M | last post by:
How do i handle a null value for a date variable type. I am retrieving date data from an access database and storing the records in an array for processing. The array field has a date type and the...
3
by: jason | last post by:
I need to deposit and empty dummy value into a date/time field within Access using INSERT. However, I pick up a data type error if I attempt to insert a NULL value for this particular date time...
8
by: Lyn | last post by:
I am trying to get my head around the concept of default, special or empty values that appear in Access VBA, depending on data type. The Access Help is not much (help), and the manual that I have...
5
by: David Sworder | last post by:
Hi, I've created a UserControl-derived class called MyUserControl that is able to persist and subsequently reload its state. It exposes two methods as follows: public void Serialize(Stream...
4
by: Peter Hemmingsen | last post by:
Hi, I have a dotnet object (implemented in mc++ and used in c#) which have a property called "Info". The Info property is also a dotnet object (implemented in mc++). In the constructor of the...
9
by: MSDNAndi | last post by:
Hi, I have a set of simple webservices calls that worked fine using .NET Framework 1.0. I am calling a Java/Apache based webservices, the calling side is not able to supply a proper WSDL. ...
1
by: recif20002002 | last post by:
I read multiple messages about this but i still can t get it working i m trying to update my access db using an update query and set a null (basically empty cell) date value I tried Date =...
10
by: satishrajana | last post by:
Hi, My SQL returns a NULL in a datefield if there is no date in that field. If there is a NULL in this column, I want to replace it with spaces in my SELECT statement when I am selecting these...
4
by: Jeff Goodman | last post by:
If there is a better newsgroup to post this in, please let me know. I am a relatively new VB.NET/SQL 2000 programmer. I am working with data imported into SQL2K from Access. Many of the dates...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.