View Full Version : Using In( ) operator in query criteria


Graham T
05-24-2002, 05:39 AM
Just a quick question:

When using the In operator, can the list of values contain the wildcard (*).

A colleague is using an OR operator that is creating a very long criteria and I thought of using the In operator.

However the values she is entering contain * as she is searching on postcodes.

I have tried this using an example of:

In ("NG*", "DD*") and it is not returning any values.

TIA

ColinEssex
05-26-2002, 11:45 PM
Try using the 'Like' operator in the query criteria

Col

Graham T
05-27-2002, 01:09 AM
Colin

Thanks for the reply. I may not have explained properly:

The reason for using the IN operator was due to the fact that at present she is having to enter something along the line of the following:

Like "NG*" Or Like "MM*" Or Like "LL*" Or Like "JJ*" Or Like "DD*" etc. etc.

This creates a very long list.

Using the IN("NG*", "MM*" etc) makes this slightly shorter and easier, however this does not appear to work when entering wildcards.

So my original query should have read:

"Can I use wildcards when using an IN("List") operator?"

Graham

Harry
05-27-2002, 07:56 AM
Answer: NO!

Possible solution though is create a new field in your query DigTest:Left(FieldBeingTested,2) This will take the 2 left most characters from your list and then you can use your IN statement but without the need for wildcards. This is of course presuming that all the things that you are testing for are 2 characters followed by wildcard.

HTH

Graham T
05-28-2002, 05:57 AM
Thanks for the reply Harry.

Something to consider....