Use of "In" in parameter queries

G

Guest

Basically In does not seem to work in a paramter query. I would like to have
a parameter that asks the user to input a list of subject numbers to
analyze. I tried using In , which works fine for regular criteria, but it
will only work if you only input one number. Can't parameter criteria take
more than one value like a list.?

A numerical range or "Between" won't work as the list could be any
combination of the numbers - 1,6,11,16,21,26,31,36,41,46,51.
 
G

Guest

You can do something like this ---
SELECT [Change Requests].x
FROM [Change Requests]
WHERE ((([Enter search list]) Like "*" & [x] & "*"));

It has a bad side in that if you enter 1 3 4 then it will find 1, 11,
12, 13,..3, 31, 32, 33,...4, 41, 42, 43,...
 
J

Jamie Collins

U

UpRider

Fred, add a column to your query for an expression:
myParam:InStr([Enter values separated by commas],[subjectnum])
for the criteria, enter >0 and uncheck the Show box.
Bingo

UpRider
 
P

Proposal Doctor

Karl,

Thanks for posting this reply in 2007. I have been looking for an hour for
a way to use a parameter query with a multi value field. Within a couple
minutes, I was able to modify your SQL voila:

.. . .
WHERE (((tblPeople.president.Value) Like "*" & [Which president?] & "*"));

Thanks.

David


KARL DEWEY said:
You can do something like this ---
SELECT [Change Requests].x
FROM [Change Requests]
WHERE ((([Enter search list]) Like "*" & [x] & "*"));

It has a bad side in that if you enter 1 3 4 then it will find 1, 11,
12, 13,..3, 31, 32, 33,...4, 41, 42, 43,...
--
KARL DEWEY
Build a little - Test a little


Fred Zack said:
Basically In does not seem to work in a paramter query. I would like to have
a parameter that asks the user to input a list of subject numbers to
analyze. I tried using In , which works fine for regular criteria, but it
will only work if you only input one number. Can't parameter criteria take
more than one value like a list.?

A numerical range or "Between" won't work as the list could be any
combination of the numbers - 1,6,11,16,21,26,31,36,41,46,51.
 

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

Top