PDA

View Full Version : Access Query Help



Vipergs8v10
05-07-2013, 07:09 PM
Hello everyone! First time poster here. I have a quick question about how to search for multiple criteria in the same column. The data in this column is not separated and represents every election a voter has voted in. For example one row of data in this column contains GE12GE11PE10GE09GE08GE06PE06GE04GE02GE00GE98GE97 while the one below it could just have PE10. I am looking to make a form with drop down boxes that allows a user to run a query to look for multiple specific elections while excluding others. For instance, I would like to search for all voters who voted in GE12 and GE11 but not those who voted in PE10 and GE02. What query or queries would i use to accomplish this? If I didn't clarify well enough please let me know. I cannot post the database for security reasons.

Transformer
05-08-2013, 12:04 PM
SELECT [Voters]
FROM
[Table]
WHERE inStr(1,[Election],"GE12") > 0 AND inStr(1,[Election],"GE11") > 0



Here Election is your column name in which you have entries like "GE12GE11PE10GE09GE08GE06PE06GE04GE02GE00GE98GE97"

To exclude, you can just change or add conditions in the above given query.
e.g. instr(1,[Election],"PE10 ") = 0

Vipergs8v10
05-08-2013, 06:32 PM
Awesome!! Thanks a lot it worked perfectly! %D