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

  • Thread starter Thread starter zh.zhen
  • Start date Start date
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?
 
Try making the query a Pass Through query. This tells JET to ignore the
syntax, which is what is causing the error to trigger.
 
Back
Top