aka_krakur
Active Member
- Joined
- Jan 31, 2006
- Messages
- 438
I have some code going where the VB adds the SQL statement to query a database.
That part of the VB is working fine
I am attempting to add a defined range to the criteria of the SQL statement
so within the SQL Statement I have something like this:
Select ID, part_number, lot_number from table1
where part_number in (123456, 654321)
I would like to change the 123456, 654321 to a named range
So in the beginning of my VB I have the following:
PartRange = Sheet1.Range(Cells(10, 2), Cells(10, Sheet1.Range("iv10").End(xlToLeft).Column))
which that code defines the range of various part_numbers user may enter that they want to query.
I thought it was as simple as changing
where part_number in ( & PartRange & )
but I am getting a type mismatch debug error.
suggestions/solutions?
That part of the VB is working fine
I am attempting to add a defined range to the criteria of the SQL statement
so within the SQL Statement I have something like this:
Select ID, part_number, lot_number from table1
where part_number in (123456, 654321)
I would like to change the 123456, 654321 to a named range
So in the beginning of my VB I have the following:
PartRange = Sheet1.Range(Cells(10, 2), Cells(10, Sheet1.Range("iv10").End(xlToLeft).Column))
which that code defines the range of various part_numbers user may enter that they want to query.
I thought it was as simple as changing
where part_number in ( & PartRange & )
but I am getting a type mismatch debug error.
suggestions/solutions?