Solved

Access Database w/ SQL "Where IN" parameters.

Posted on 2013-11-04
5
320 Views
Last Modified: 2013-11-09
Sample Data:

Roll			Description			Price
========		==========			=======
2			Test				1.00
3			Test #2				2.00
...
8500			Final Test			499.00

Open in new window


I'm trying to allow my user to type: "3, 4, 800, 6789" and for my database to pull up a list of those rows.

I know that the query would look like this:

"SELECT * FROM `Inventory` WHERE IN `Roll` (3, 4, 800, 6789)"

I just can't pick apart all these "VBA", "Stored Procedure", and other posts about the topic because it seems so easy and obvious to do.

Ask user for input, plug the input into query. What am I missing and please be detailed since I come from the PHP MVC and MySQL world.
0
Comment
Question by:advantagec
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39621479
the syntax is

"SELECT * FROM Inventory  WHERE Roll  IN(3, 4, 800, 6789)"

if Roll is of Text Data type, you need to enclosed the values with quotes or single quotes


"SELECT * FROM Inventory  WHERE Roll  IN('3', '4', '800', '6789')"
0
 

Author Comment

by:advantagec
ID: 39621508
You ignored the question. I don't care about my syntax, I need to know how to parameterize a "WHERE IN" query in Access 2013.
0
 

Accepted Solution

by:
advantagec earned 0 total points
ID: 39621615
For anyone in the future:

http://support.microsoft.com/kb/100131

See Method #2. Extremely simple and it just worked. Just don't make the same mistake I did and name your module "InParam", since that's already the name of a function and it will error.
0
 

Author Closing Comment

by:advantagec
ID: 39635426
The only real answer, and it worked.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question