Question

I have searched forever and cannot find a solution that works. Most likely because of ignorance.

The database that I am querying is Interbase so the SQL syntax might be different than what I'm used to. When I add the following line to my SQL statement I get an error "Run time error: 1004" SQL Syntax Error.

"AND    p.DISPLAY_NAME LIKE %" & Worksheets("Page1").Range("H9").Value & "%"

Any help is greatly appreciated!

Was it helpful?

Solution

I don't know about interbase but I suspect you need to surround the text-expression with apostrophes:

"AND    p.DISPLAY_NAME LIKE '%" & Worksheets("Page1").Range("H9").Value & "%'"

Remove the unnecessary spaces as well:

"AND p.DISPLAY_NAME LIKE '%" & Worksheets("Page1").Range("H9").Value & "%'"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top