exclude statement for query criteria

  • Thread starter Thread starter GitarJake
  • Start date Start date
G

GitarJake

Hello all,

In building a query, I use:

Not Like *mystring*

if mystring may be part of a larger string. Access then converts the
criteria to:

Not Like "*mystring*"

And I use:

<>mystring

if I am searching on a field that might contain mystring. Access then
converts the criteria to:

<>"mystring"

But I am to exclude a string that already has quotes (i.e: "-"). When I
enter <>"-" Access sees the criteria syntax as correct and doesn't filter
the data. How do I phrase the criteria to exclude fields that are already
wrapped in quotes?

Any thoughts?

TIA

Jake
 
your post is very confusing. What do you want to exclude? What string are
you excluding?


"-"
or
-

Give us an example of two or three fields and tell us if they should or
should not be included in the results.

Rick B

Hello all,

In building a query, I use:

Not Like *mystring*

if mystring may be part of a larger string. Access then converts the
criteria to:

Not Like "*mystring*"

And I use:

<>mystring

if I am searching on a field that might contain mystring. Access then
converts the criteria to:

<>"mystring"

But I am to exclude a string that already has quotes (i.e: "-"). When I
enter <>"-" Access sees the criteria syntax as correct and doesn't filter
the data. How do I phrase the criteria to exclude fields that are already
wrapped in quotes?

Any thoughts?

TIA

Jake
 
A different approach would be to add an additional field to your query using
Instr() function to test whether your string occurs in the data. If it does,
Instr() will return a numerical value other than 0.

Then, in criteria for that field, use = 0 to show only those records that
don't include any occurances of your string, or >0 to show those records
that do include it.

HTH,

George Nicholson

Remove 'Junk' from return address.
 
Back
Top