Solved

Access Database w/ SQL "Where IN" parameters.

Posted on 2013-11-04
5
314 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
  • 3
5 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
The only real answer, and it worked.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

763 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now