Parameter query using In

PHodgson

New Member
Joined
Mar 1, 2005
Messages
2
I am trying to make an MS Query interactive based on a list of values.
The usual SQL syntax for the selection is something on the lines of:
Where Fieldname In ('Value1','Value2','Value3)
However I'm trying to make this a parameter query, so my syntax is:
Where Fieldname In (?)

When the parameter dialog opens for the value list to be entered, what should the syntax of the reponse be ?

I've tried:
Value1
on it's own, this works. However, for a list of values it does not seem to work as I must have the wrong sytax. I've tried:

'Value1','Value2'
Value1, Value2
('Value1','Value2')
etc., but none seem to work. Any ideas ?
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
The placeholder for a parameter is a scalar -- not an array. Try this...

SELECT List.Fruit, List.Qty
FROM Book1.List List
WHERE (List.Fruit=?) OR (List.Fruit=?)
 
Upvote 0
Mark,
I understand if the number of values is known and in your example is 2, but the reason for using the In syntax was to allow multiple values to be entered at query run time, and not the same number of values each time.
 
Upvote 0

Forum statistics

Threads
1,214,632
Messages
6,120,655
Members
448,975
Latest member
sweeberry

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