RE: List of Matches in WHERE Clause
- From: Ofer Cohen <OferCohen@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 10 Jul 2006 07:52:02 -0700
There is a problem with this method with passing unlimited amount of
parameters, this SQL
Select * From TableName Where FieldName In ([Please select parameter])
When the parameter is 'A','C' it wont look for A and C, it will look for a
string 'A','B' and not seperate.
In that case i would use some code to insert a new SQL to a Query
Application.CurrentDb.QueryDefs("QueryName").SQL = "Select * From TableName
Where FieldName In (" & StrParameter & ")"
================================
I hope it's clear.
Ofer Cohen
Modiin
--
Good Luck
BS"D
"Alex Maghen" wrote:
Brilliant! I didn't know you could do that. Then in that case, let me ask you.
a related question - Let's say I don't know how many of those items in the
WHERE clause I'm going to be handline and I want to pass them as parameters
to an Access Query from my application. Is there a way to provide sort of an
open-ended list parameter to an Access query? The way you can have a "params
char[] SomeList" in a C# function declaration? Know what I mean?
In any case, THANKS!
Alex Maghen
Tel Aviv
"Ofer Cohen" wrote:
You can use
select * from SomeTable
where SomeColumn In ('A','Q','Y','M')
--
Good Luck
BS"D
"Alex Maghen" wrote:
Hi. Is there a shorthand for matching a list of items in the WHERE clause?
Here's what I mean:
select * from SomeTable
where
(
(SomeColumn='A')
or
(SomeColumn='Q')
or
(SomeColumn='Y')
or
(SomeColumn='M')
)
Is there some way to make a list of things to match "SomeColumn" instead of
having to do many "OR"s?
Alex
- Prev by Date: Re: Subtracting Hours
- Next by Date: Running Total - Running Sum
- Previous by thread: Re: Subtracting Hours
- Next by thread: Re: List of Matches in WHERE Clause
- Index(es):
Relevant Pages
|