I
Ian Baker
I am using the following sql to insert the values of certain fields on a
form into another table and are trying to ascertain the right way to treat
strings. The problem is if the user enters a ' as in O'Brian or " as in
"said this" in the field an error occurs. If I use '" & MyField & "' then
the user can't use ' or if I use """ & MyField & """ then the user can not
use "
strInsert = "INSERT INTO tblKnowledgeBase ( Type, Category, AssetType, " & _
"CallDescription, MakeModel, Resolution, CallID ) " & _
"SELECT """ & ctlTypeID.Column(1) & """ AS Expr1, """ &
ctlCategoryID.Column(2) & """ AS Expr2, " & _
"""" & ctlAssetID.Column(2) & """ AS Expr3, """ & ctlCallDescription &
""" AS Expr4, " & _
"""" & ctlAssetID.Column(3) & """ AS Expr5, """ & strResolution & """ AS
Expr6, " & CallID & " AS Expr7;"
Any suggestion is appreciated
--
Regards
Ian Baker
Jackaroo Solutions Pty Ltd
(Download Jackaroo IT - an IT Mgmt and Help Desk application at
http://jackaroo.net.au)
form into another table and are trying to ascertain the right way to treat
strings. The problem is if the user enters a ' as in O'Brian or " as in
"said this" in the field an error occurs. If I use '" & MyField & "' then
the user can't use ' or if I use """ & MyField & """ then the user can not
use "
strInsert = "INSERT INTO tblKnowledgeBase ( Type, Category, AssetType, " & _
"CallDescription, MakeModel, Resolution, CallID ) " & _
"SELECT """ & ctlTypeID.Column(1) & """ AS Expr1, """ &
ctlCategoryID.Column(2) & """ AS Expr2, " & _
"""" & ctlAssetID.Column(2) & """ AS Expr3, """ & ctlCallDescription &
""" AS Expr4, " & _
"""" & ctlAssetID.Column(3) & """ AS Expr5, """ & strResolution & """ AS
Expr6, " & CallID & " AS Expr7;"
Any suggestion is appreciated
--
Regards
Ian Baker
Jackaroo Solutions Pty Ltd
(Download Jackaroo IT - an IT Mgmt and Help Desk application at
http://jackaroo.net.au)