Query Multiple Values from same column

  • Thread starter Thread starter BR
  • Start date Start date
B

BR

I have query that runs correctly when using single values in a parameter.
I need to be able to input several values at once. In SQL I could use the IN
statement, but have not been able to do this is Access yet.

Any suggestions and insights would be appreciated. Please give examples.

Thanks in Advance.
 
The IN condition is supported in Jet SQL. For example:
SELECT * FROM tblAddress WHERE State IN ("NY", "VA", "IL")
 
BR said:
I have query that runs correctly when using single values in a parameter.
I need to be able to input several values at once. In SQL I could use the IN
statement, but have not been able to do this is Access yet.

Say you have a table of Students:

Student Department
Neil Physics
Peter Maths
Edward Chemistry
Paul Home Economics
Jane Biology
Maxwell Medicine
Simon Maths
Fred Physics
Jeremy English

Then this query:
SELECT
Student, Department
FROM
tblStudents
WHERE
Department IN ([First Department], [Second Department])

Will prompt you for two separate Department names.


(Incidentally, my spell-checker wants to change 'tblStudents' to
'bladdernuts'. Completely irrelevant, but I thought I'd share <g>)
 
Back
Top