how can i set a variable from an access query to another

Z

zh.zhen

I have create an query in access like blow, which named spProductList:
SELECT ProductID,ProductName,CategoryID FROM Product
And I want to do a filter by CategoryID,then create an another query
named spProductListByCatID:
PARAMETERS [@intCatID] SHORT;
SELECT ProductID,ProductName,CategoryID FROM Product Where CategoryID =
[@intCatID]

The Problem is:
1. I can do an query in access like:
SELECT * FROM spProductList
it lists all record.
2. But I can't do it like this:
SELECT * FROM spProductListByCatID('@intCatID=1')

It seems I can not set a variable to an query in this way. how can I
share spProductListByCatID in another qurey and set a value to the
variable directly?
 
M

[MVP] S.Clark

Try making the query a Pass Through query. This tells JET to ignore the
syntax, which is what is causing the error to trigger.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top