I'm trying to piece together a SQL statement that joins two tables and creates a recordset based on a name. The name is stored in a variable called strAuthor but I can't get my SELECT statement to put the name in quotes. Here is my SQL statement:
When I execute my program it gets a runtime error 3075 syntax error as shown in the following attachment:
Error 3075 Sql Syntax.doc
As you can see in the error message, the Where clause is being converted to:
Instead of:
How do I modify my original SELECT statement shown above to get the necessary quotes around strAuthor? Thank you in advance.
Code:
"SELECT BOOK_SET_ASSOCIATIONS.ISBN, BOOKS.AUTHOR, BOOKS.BOOK_SET_ID" & _
"FROM BOOK_SET_ASSOCIATIONS INNER JOIN BOOKS ON BOOK_SET_ASSOCIATIONS.ISBN = BOOKS.ISBN" & _
"Where (((BOOKS.AUTHOR) = " & strAuthor & "))" & _
"ORDER BY BOOKS.BOOK_SET_ID"
Error 3075 Sql Syntax.doc
As you can see in the error message, the Where clause is being converted to:
Code:
"Where (((BOOKS.AUTHOR) = Robert James Waller))
Code:
"Where (((BOOKS.AUTHOR) = "Robert James Waller"))