• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Using cell range as sql parameters

I'm really at a loss here and it seems to be such a simple task that I must be missing the forest for the trees. I am given an excel 2007 worksheet with columns of part numbers, descriptions etc. which usually is no more than one hundred rows. I need to access an external database AS400(DB2) and run a query against a table with the same fields, compare the columns and highlight the differences between them. I'll connect with ODBC and probably use VLOOKUP for comparison. The part that is tripping me up is how to specify the sql parameters when setting up the query. In my SELECT* I want to pass in the values from a range of cells if possible, say A1:A75 by highlighting the range or by using a function. Any suggestions?
 
I'm just using the Microsoft Query Wizard to set up the select statement. To keep it brief for testing, I'm only returning two fields in this query. SELECT itmnum, sdesc FROM ivpitems WHERE itmnum=?
 
I'm not certain if you could pass a range of cells via MS Query or not. I mean, yes, you can set up multiple parameters, but that's really what you're trying to do. If you were to try to do this with like ADO or something, you could relatively easily build the where statement with a string in a cell, but I'm not sure if that could work with MSQ.


Although, an interesting problem. I'll try to come up with something.
 
Back
Top