Parameterize "WHERE IN([x]) ..." query syntax

Lumine

New Member
Joined
Jul 13, 2006
Messages
26
Hi,

I'm trying to query external data from an access database and trying to parameterize the IN() part of the where statement and I can't seem to get the syntax right.

I am not sure if it is a part of the syntax of the sql or the syntax of my inputs. My sql reads:

Code:
SELECT column_name
FROM table_name
WHERE column_name IN (?)

I've tried inputs like the following
Code:
input1,input2
'input1','input2'
('input1','input2')
input1                       <-- the only one that works

Any thoughts? I can't seem to get this guy working
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
you write that the only one that works is : input1

some thoughts. I think the syntax will be input1 if the field contains numeric entries; if it contains text, I'd expect 'input1'

therefore you have numeric entries?

for multiple numeric entries, try : IN (input1, input2, input3, etc)

OK?
 
Upvote 0
You can't use one parameter to build a multi-value IN clause. The whole parameter is treated as one element in the In clause.
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,633
Members
452,661
Latest member
Nonhle

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top