I have an Excel 2007 (Win 7) utility worksheet that uses VBA/SQL to extract data from a table located on a separate Excel data worksheet. The code works fine whether or not the data worksheet is open in Excel, except for one thing (at least so far). If I use LIKE in the SQL (e.g. WHERE city_prov LIKE '%NS%') :
- if the data worksheet is open, this expression is case sensitive
- if the data worksheet is not open, the expression is case insensitive
So I can get completely different results depending on whether or not the data worksheet is open when I run the query. Does this make sense to anyone?
I want the LIKE to be case sensitive. I can ensure that this happens by adding code to open the data worksheet before the query is implemented. However, I would be curious to know why there should be any difference in the way the SQL is interpreted in these two cases.
Bookmarks