D
David G.
I'm trying to write an SQL statement where one or more field entries
include strings with quotations mark.
for instance:
20" Tube
The quotation mark translates to "inches", and needs to be stored in
the field.
or in another case
Support "T"-Beam
Here's short (very abbreviated) example of what I'm trying to do in
VBA (which doesn't work, by the way)....
Sub MySub()
Dim strField1 as string
Dim strField2 as String
Dim QUOTE as String
QUOTE="""
' comment triple quotations to improve code readability.
strField1=xmlFile.ChildNodes(0).Text
' comment: Text from node is 'Support "T"-Beam' (w/o single quote
marks)
if InStr(1,strField1,Chr$(34)) Then
strField=Replace(strField1,Chr$(34), QUOTE)
strField2=xmlFile.ChildNodes(1).text
' comment: Nothing special about this text
strSQL="INSERT INTO " & strTablename & " (FIELD1, FIELD2) " & _
"Values (" & QUOTE & strField2 & ", " & QUOTE & strField1 & ");"
currentdb.execute strSQL,dbFailOnError
End Sub
Any insight would be greatly appreciated.
THANKS!
David G.
include strings with quotations mark.
for instance:
20" Tube
The quotation mark translates to "inches", and needs to be stored in
the field.
or in another case
Support "T"-Beam
Here's short (very abbreviated) example of what I'm trying to do in
VBA (which doesn't work, by the way)....
Sub MySub()
Dim strField1 as string
Dim strField2 as String
Dim QUOTE as String
QUOTE="""
' comment triple quotations to improve code readability.
strField1=xmlFile.ChildNodes(0).Text
' comment: Text from node is 'Support "T"-Beam' (w/o single quote
marks)
if InStr(1,strField1,Chr$(34)) Then
strField=Replace(strField1,Chr$(34), QUOTE)
strField2=xmlFile.ChildNodes(1).text
' comment: Nothing special about this text
strSQL="INSERT INTO " & strTablename & " (FIELD1, FIELD2) " & _
"Values (" & QUOTE & strField2 & ", " & QUOTE & strField1 & ");"
currentdb.execute strSQL,dbFailOnError
End Sub
Any insight would be greatly appreciated.
THANKS!
David G.