Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21292

Need Help With SQL Statement In VB6 Application

$
0
0
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:

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"

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:

Code:

"Where (((BOOKS.AUTHOR) = Robert James Waller))
Instead of:

Code:

"Where (((BOOKS.AUTHOR) = "Robert James Waller"))
How do I modify my original SELECT statement shown above to get the necessary quotes around strAuthor? Thank you in advance.
Attached Files

Viewing all articles
Browse latest Browse all 21292

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>