By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,841 Members | 1,757 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,841 IT Pros & Developers. It's quick & easy.

Multiple Criteria

P: 1
Hi everyone,

I'm a relative newbie to access so hopefully this will be easy for everyone.

I'm trying to limit the field in a query so that it does not include lines where their value is equal to 3, 5, 16,or 17.

I type

<>3
5
(separate lines)

and I've tried

<>3 Or 5

Both ways, the only variable that is taken away from the field is the 3. If I make the 5 right after the <>, then it is only the 5 that get taken away. What am I doing wrong and how can I fix this? Thanks!
Sep 26 '08 #1
Share this Question
Share on Google+
7 Replies


missinglinq
Expert 2.5K+
P: 3,532
Place this in the Criteria box for your field in the Query Grid:

Not Like "[3,5,16,17]"

just like that, with quatation marks and brackets.

Welcome to Bytes!

Linq ;0)>
Sep 26 '08 #2

DonRayner
Expert 100+
P: 489
Hi everyone,

I'm a relative newbie to access so hopefully this will be easy for everyone.

I'm trying to limit the field in a query so that it does not include lines where their value is equal to 3, 5, 16,or 17.

I type

<>3
5
(separate lines)

and I've tried

<>3 Or 5

Both ways, the only variable that is taken away from the field is the 3. If I make the 5 right after the <>, then it is only the 5 that get taken away. What am I doing wrong and how can I fix this? Thanks!
not 3 and not 5 and not 16 and not 17

or you could do it like this

<>3 and <>5 and <>16 and <>17

You need to and the conditions togeather.
Sep 26 '08 #3

NeoPa
Expert Mod 15k+
P: 31,660
Please remember to provide a meaningful Title for any threads started (Please Use Appropriate Titles for New Threads!). This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.

Administrator.

PS. Linq has provided exactly the correct method to use.
Sep 26 '08 #4

NeoPa
Expert Mod 15k+
P: 31,660
Oops!

Reading it again I'm not so sure :S That is based on string only filtering and may well not (I don't think it does in truth) work in this situation.

Try instead "Not In(3,5,16,17)"
Sep 26 '08 #5

missinglinq
Expert 2.5K+
P: 3,532
Reading it again I'm not so sure :S That is based on string only filtering and may well not (I don't think it does in truth) work in this situation.
Not sure what you mean, Ade!

Not Like "[3,5,16,17]"

works whether the field is Numeric (which I originally tested, based on the original post) and if the field is defined as Text, which I just now checked..

Linq ;0)>
Sep 26 '08 #6

NeoPa
Expert Mod 15k+
P: 31,660
I tested it earlier and it didn't work for me. If you say it does I'll try it again then.
Sep 27 '08 #7

NeoPa
Expert Mod 15k+
P: 31,660
I knocked up a quick table with numbers 1 - 15 in a field.

I knocked up a quick query with criteria = "Like '[1,7,13]'"

The results returned were :
1; 3; 7
Sep 27 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.