Reputation: 21
I'm having some trouble passing a particular type of parameter from an Excel cell value to an ODBC query. It's a DB2 database on an AS400 server, and I'm using the iSeries Access ODBC Driver from IBM.
Here is the query with hard-coded values:
SELECT STKB.BXPART, STKB.BXSTOK, STKB.BXQTOH, STKB.BXUNIT
FROM CMSDAT.STKB STKB
WHERE (STKB.BXPART In ('BAG024','BAG709'))
And the desired result:
What i would like to do is pass the list from an Excel value to the parameter. The query is modified like so:
SELECT STKB.BXPART, STKB.BXSTOK, STKB.BXQTOH, STKB.BXUNIT
FROM CMSDAT.STKB STKB
WHERE (STKB.BXPART In (?))
And the parameter is set to pull from a cell:
If I put one value in the cell, the query returns the results for that one value. If I try more than one item the query returns empty. I've tried the following values in the cell AA4:
('BAG024','BAG709')
(BAG024,BAG709)
'BAG024','BAG709'
BAG024,BAG709
Has anyone successfully used cell values for an 'in' parameter?
Thanks!
Upvotes: 2
Views: 2300