criteria logic mystery

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a column which either contains "y" or is blank. Yet requesting all
records with "NOT "y"" in that column does not capture all the records with a
blank entry for that column. In other words, the total number of records is
greater than those captured by requesting records with "y" in the column Plus
those which are blank, as captured by "NOT "y"" or "<> "y"".

What is going on here? I've had some other weird programming trouble ever
since I imported the data from an excel spreadsheet. Is this related?
 
Hi Tony,

try this for criteria:

field --> fieldname_: nz([fieldname],"")
criteria --> <> "Y"

or, in SQL
WHERE nz([fieldname],"") <> "Y"

NZ converts null values so they can be compared

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 
It worked!

Do you know where these "null values" come from? Is there another way to
detect and replace them with "real data"? Although it worked, the solution
seems a bit bizzare to a simple user like me.
--
Tony


strive4peace" <"strive4peace2006 at yaho said:
Hi Tony,

try this for criteria:

field --> fieldname_: nz([fieldname],"")
criteria --> <> "Y"

or, in SQL
WHERE nz([fieldname],"") <> "Y"

NZ converts null values so they can be compared

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
I have a column which either contains "y" or is blank. Yet requesting all
records with "NOT "y"" in that column does not capture all the records with a
blank entry for that column. In other words, the total number of records is
greater than those captured by requesting records with "y" in the column Plus
those which are blank, as captured by "NOT "y"" or "<> "y"".

What is going on here? I've had some other weird programming trouble ever
since I imported the data from an excel spreadsheet. Is this related?
 
Okay. I found another solution which is more understandable to me:

criteria -->IS NULL OR <> "y"

I just wasn't aware of the null case in "blank data entries".
--
Tony


Tony said:
It worked!

Do you know where these "null values" come from? Is there another way to
detect and replace them with "real data"? Although it worked, the solution
seems a bit bizzare to a simple user like me.
--
Tony


strive4peace" <"strive4peace2006 at yaho said:
Hi Tony,

try this for criteria:

field --> fieldname_: nz([fieldname],"")
criteria --> <> "Y"

or, in SQL
WHERE nz([fieldname],"") <> "Y"

NZ converts null values so they can be compared

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
I have a column which either contains "y" or is blank. Yet requesting all
records with "NOT "y"" in that column does not capture all the records with a
blank entry for that column. In other words, the total number of records is
greater than those captured by requesting records with "y" in the column Plus
those which are blank, as captured by "NOT "y"" or "<> "y"".

What is going on here? I've had some other weird programming trouble ever
since I imported the data from an excel spreadsheet. Is this related?
 
Hi Tony,

"Do you know where these "null values" come from? "

An entry with no value Is Null

Is there another way to detect and replace them with "real
data"?

If you have no value for this field, it is better to leave
it blank than to put something where nothing should be.

In Access, Null cannot be compared to a value because there
is nothing to compare ... NZ changes Null from nothing to
something...


Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top