Query Not = question

  • Thread starter Thread starter Junior
  • Start date Start date
J

Junior

just realized my query isn't working properly and i'm stumped

Have a text field [RPlan] in a table
QRY1 contains [RPlan]
I want to find all records in QRY1 that do not contain "XXX" in [Rplan]

not="XXX" doesn't work
null works but doesn't ensure only XXX is the only records excluded

What is the proper way to exclude only records containing XXX when querying
QRY1 in a second query??
 
Thanks
Gary Walter said:
Hi Junior,

WHERE NZ(([RPlan]<>'XXX'),-1)

just realized my query isn't working properly and i'm stumped

Have a text field [RPlan] in a table
QRY1 contains [RPlan]
I want to find all records in QRY1 that do not contain "XXX" in [Rplan]

not="XXX" doesn't work
null works but doesn't ensure only XXX is the only records excluded

What is the proper way to exclude only records containing XXX when querying
QRY1 in a second query??
 
Just to be sure,
WHERE returns record
when condition = -1 (True)

[RPlan] NZ(([RPlan]<>'XXX'),-1)
'XXX' 0 (False)
<>'XXX' -1 (True)
Null -1 (True)

or

[RPlan] NZ(([RPlan]<>'XXX'),0)
'XXX' 0 (False)
<>'XXX' -1 (True)
Null 0 (False)
 
Back
Top