0

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!

John Dawyers
  • 65
  • 1
  • 11
  • I think you are more likely to get help if you avoid expressions such as "I have searched forever". – Andy G Jun 28 '13 at 18:49

1 Answers1

2

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 & "%'"
Andy G
  • 19,232
  • 5
  • 47
  • 69