Passing parameters to a stored query in Access 97 
Author Message
 Passing parameters to a stored query in Access 97

I want to use the IN (15,16,17) clause in Access SQL togheter with an
parameter, my query look like this, and works fine:

SELECT Svar.P?st?ende_Nr, First(P?st?enden.Nummer) AS Nummer,
First(P?st?enden.P?st?ende) AS P?st?ende, Avg(Svar.Svar) AS Svar
FROM P?st?enden INNER JOIN (Personal INNER JOIN Svar ON Personal.Personal_Nr
= Svar.Personal_Nr) ON P?st?enden.P?st?ende_Nr = Svar.P?st?ende_Nr
WHERE Personal.Item_Nr In (15,16)
GROUP BY Svar.P?st?ende_Nr
HAVING Min(Year([Personal].[Datum]))=[pn?r]) AND
Min(Year([Svar].[Datum]))=[pn?r];

I would like to have it like this: WHERE Personal.Item_Nr In ([psItems])
where then psItems="15,16,17", why dosn't this work, and how can I get it to
work?

Mikael Tilly



Fri, 08 Sep 2000 03:00:00 GMT  
 Passing parameters to a stored query in Access 97

        I'm affraid It won't work unless you concatenate the string
        instead of passing as a parameter.
        Look, in the MSAccesxx it is not posible that way,
        so, in VB neither... 8-(
        You already have the SQL string, just concatenate you param-string
        and try.

        PD.
        The Access workaround is on Access KB
        INF: How to Create a Parameter In() Statement
        Article ID: Q100131

HTH
Raul Coba Poot



Quote:
> I want to use the IN (15,16,17) clause in Access SQL togheter with an
> parameter, my query look like this, and works fine:

> SELECT Svar.P?st?ende_Nr, First(P?st?enden.Nummer) AS Nummer,
> First(P?st?enden.P?st?ende) AS P?st?ende, Avg(Svar.Svar) AS Svar
> FROM P?st?enden INNER JOIN (Personal INNER JOIN Svar ON

Personal.Personal_Nr
Quote:
> = Svar.Personal_Nr) ON P?st?enden.P?st?ende_Nr = Svar.P?st?ende_Nr
> WHERE Personal.Item_Nr In (15,16)
> GROUP BY Svar.P?st?ende_Nr
> HAVING Min(Year([Personal].[Datum]))=[pn?r]) AND
> Min(Year([Svar].[Datum]))=[pn?r];

> I would like to have it like this: WHERE Personal.Item_Nr In ([psItems])
> where then psItems="15,16,17", why dosn't this work, and how can I get it
to
> work?

> Mikael Tilly



Fri, 08 Sep 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Passing parameters to an Access 97 - query

2. Passing Parameters to Word 97 from Access 97!

3. Stored, Pass Through, Parameter Query on Access 2k and SQL Server 7

4. Passing Parameters to stored parameter queries using VB 5's Data Controls

5. Problem with ADO and Stored Procedures with parameters in an Access 97 database

6. Unable to Update in VB5.0 DBGrid from Stored Query in Access 97

7. Passing Report Parameters from VB6 to Access 97

8. Passing Parameters to Access 97

9. Passing parameters to Access 97 reports

10. Can I run a parameter query on Access 97 database

11. Access 97 Parameter Queries and VB Data Reports

12. Access 97 Parameter Queries and VB Data Reports

 

 
Powered by phpBB® Forum Software