return true in sql statement

J

Joanne

I have a query to return true if a doc contains bookmarks. I built it
in the query builder grid, and grabbed this statement from 'View/Sql"

SELECT tblDocumentList.DocNamePath FROM tblDocumentList
WHERE (((tblDocumentList.Bookmarks)=True));

This is the way I plugged the sql statement into my access routine,
but when I the routine, I get a syntax error on the sql statement.

BsSql = "SELECT tblDocumentList.DocNamePath FROM tblDocumentList" & _
" WHERE (((tblDocumentList.Bookmarks) = True)) """

I can't see where the error is, but I do know you can't just drop the
sql statement from the query grid into access and have success in
running it. What I need to know is what is wrong with this particular
statement, and what are the rules for using the query grid sql
statements in an actual access routine, such as the difference between
using the semi-colon and quote marks. Also, would I do better to just
run the query from within my access routine and avoid this problem
altogether? Even so, I still would like to know what the differences
in syntax are.

Thanks for your help
 
K

Ken Snell [MVP]

BsSql = "SELECT tblDocumentList.DocNamePath FROM tblDocumentList" & _
" WHERE (((tblDocumentList.Bookmarks) = True)) "

You need only one " character at the end, not three.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top