I have set up an SQL query of an Excel Worksheet using VBA in Excel. The query works when I "hardcode" the search string, but when I use a variable, I get the following error:
Run Time Error: '1004'
General ODBC Error.
Here is the code with the variable xCaseNo.
If I supply the CaseNo by typing it in a string enclosed in single quotes, the query works, as in:
When I get the error message the oQt.Refresh line is highlighted in yellow.
I suspected the problem may be related to SQL requiring quotes around the search string, so I defined xCaseNo as
, but that didn't work either.
Thanks.
Bookmarks