![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
in access97, this works SELECT businessId FROM tblBusiness WHERE baanPostalId = null but not in access2007, it needs to be SELECT businessId FROM tblBusiness WHERE baanPostalId is null is there a compatiblity option that allows the original version to run ? |
#3
| |||
| |||
|
|
Roger wrote: in access97, this works SELECT businessId FROM tblBusiness WHERE baanPostalId = null but not in access2007, it needs to be SELECT businessId FROM tblBusiness WHERE baanPostalId is null is there a compatiblity option that allows the original version to run ? Given that "baanPostalId = null: should not have "worked" in A97, I doubt you will get a workaround. It likely ran without error, but it almost certainly did not return the results you wanted. If it did, it is likely that baanPostalId did not contain what you thought it did. Nothing ever "equals" Null, not even in A95, let alone A97. That's part of the definition of Null: "unknown value" never equals "unknown value". Only a known value can equal a known value. Unknown can _be_ unknown, but it can never equal it. Are you telling me that attempting to use "baanPostalId = null" throws an error in A2007? If so, all I can say is "Bravo!". |
#4
| |||
| |||
|
|
To add to what Bob said, the idea that Unknown = Unknown is not valid. It's error #5 in this list: Common Errors with Null at: http://allenbrowne.com/casu-12.html |
#5
| |||
| |||
|
|
In Access 2003 entering <> Null as criteria, gets automatically changed to is not Null and = null gets changed to is Null. So that could be the reason that the = null criteria worked. Running a quick check with the following Public Function xxx() Dim strSQL As String Dim rst As DAO.Recordset strSQL = "SELECT Count(*) FROM FAQ WHERE fSubject <> null" Set rst = CurrentDb().OpenRecordset(strSQL) Debug.Print rst.Fields(0) End Function I get 676 with <> Null I get 0 with = Null Which is exactly what I get if I use is Not Null and Is Null. Personally I would rather the "magic" did not happen. And I guess that in the change from 2003 to 2007 this "magic" was removed. John Spencer Access MVP 2002-2005, 2007-2010 The Hilltop Institute University of Maryland Baltimore County Allen Browne wrote: To add to what Bob said, the idea that Unknown = Unknown is not valid. It's error #5 in this list: Common Errors with Null at: http://allenbrowne.com/casu-12.html |
![]() |
| Thread Tools | |
| Display Modes | |
| |