PC Review


Reply
Thread Tools Rate Thread

Data Mismatch in Query Criteria Inconsistency

 
 
MIG
Guest
Posts: n/a
 
      1st Nov 2011
I was being driven mad by getting data mismatch errors in queries, and
it looks like it may be down to inconsistent ways of dealing with
Nulls in Access.

I had been attempting to match postcodes while disregarding spaces.

As it happens

Left([postcode 1],3)

and

Replace([postcode 1]," ","")

are both valid expressions, even if [postcode 1] is Null.

the comparison

Left([postcode 1], 3) = Left([postcode 2], 3)

is also perfectly valid, even if either or both fields contain a Null.

But the comparison

Replace([postcode 1]," ","") = Replace([postcode 2]," ","")

causes a data mismatch error if either field contains a Null.

So why does Replace cause a problem with Null when Left doesn't? And
why is the error message so bluddy useless?

It seems that one can get round the error by using nz([postcode 1],"")
or whatever, but it wasn't obvious and wasted a couple of hours.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:37 AM.