M
Michael T
I have an SQL statement which I build as follows:
strSQL = "UPDATE tblDesign " & _
"SET " & strFieldNameForUpdate & " = '" & strDM & "' " & _
"WHERE DesignName = '" & strName & "' ;"
However, in some instances there is an apostrophe in the data in strName
(e.g. King's Dinner) and therefore this code builds the string:
UPDATE tblDesign SET DesignMonarchSide = 'R' WHERE DesignName = 'King's
Dinner' ;
I cannot eliminate the apostrophe because it is in the data in the table we
are updating (I know it's not the nicest way of updating but this row is the
key and I am stuck with it).
I have considered searching for the apostrophe and splitting the string into
two with an apostrophe between both (eg ending up with something like
"'King" & "'" & "s Dinner") but this gets incredibly complicated.
Is there an easy way to get round this?
Thanks,
Michael.
strSQL = "UPDATE tblDesign " & _
"SET " & strFieldNameForUpdate & " = '" & strDM & "' " & _
"WHERE DesignName = '" & strName & "' ;"
However, in some instances there is an apostrophe in the data in strName
(e.g. King's Dinner) and therefore this code builds the string:
UPDATE tblDesign SET DesignMonarchSide = 'R' WHERE DesignName = 'King's
Dinner' ;
I cannot eliminate the apostrophe because it is in the data in the table we
are updating (I know it's not the nicest way of updating but this row is the
key and I am stuck with it).
I have considered searching for the apostrophe and splitting the string into
two with an apostrophe between both (eg ending up with something like
"'King" & "'" & "s Dinner") but this gets incredibly complicated.
Is there an easy way to get round this?
Thanks,
Michael.