John W. Colby
jwcolby at colbyconsulting.com
Wed Aug 24 22:23:01 CDT 2005
I'm attempting to build a SQL statement to append data into a record. One
of the fields is text, including (possibly) any valid text including ' - for
example in contractions such as "aren't" etc.
My SQL statement is building up a statement in the format:
lstrSQL = "INSERT INTO WebNewsItem ( WebNewsSourceID, Link,
Title, ArticleDescription ) " & _
"SELECT " & webNewsSourceID & " AS WebNewsSourceID,
'" & link & "' AS Link, '" & title & "' AS Title, '" & description & "' AS
ArticleDescription;"
The problem is that description can contain the ' character and thus I end
up with an invalid SQL statement since the ' embedded in description "looks
like" the ' that is supposed to enclose the text.
I can't for the life of me remember how I am supposed to handle this.
I could punt and open a recordset, create a new record, and place the data
directly into the field, which I may end up doing but I sure would prefer to
just do the "append query" thing. It is (was) much simpler.
John W. Colby
www.ColbyConsulting.com
Contribute your unused CPU cycles to a good cause:
http://folding.stanford.edu/