I am using MS Query with an ODBC database query to a SQL database.
I successfully set-up the query using parameters. If I enter full and complete value into the parameter cell, then I successfully get the data back. But, no results are returned if I enter a wildcard character as a parameter.
For example: If I am searching the SQL database for a part number. If I enter the full part number "EAF16273".... then it returns correctly. But, if I enter "%627%", then I get no results.
Question: How can I pass the % wildcard character through to a SQL query using MS Query and ODBC?
I've tried the suggestions included in the reference posts, below, but none have worked. Does anyone have an alternative suggestion?
MORE DETAILS:
When I enter Like '%627%' in the MS Query criteria field... that works ok.
But, if I enter Like '%'&[part number]&'%' .... this doesn't work. I get the response "The data types varchar and char are incompatible in the '&' operator. Statement(s) could not be prepared."
If I enter only [part number].... then in the excel cell I enter %627% that doesn't work. I tried entering as a formula reference to a differenent cell (as suggested in reference posts, below).... but that didn't work either.
Thank you for your help!
Note:
There are several old posts on this topic, but none have solved my problem.
Reference:
http://www.excelforum.com/excel-prog...parameter.html
http://www.excelforum.com/excel-prog...-wildcard.html
http://www.excelforum.com/excel-prog...parameter.html
Bookmarks