nvwildfire
Technical User
Hello list, hope this is easy.
My problem is I have a text field(txtDescription) on a form that may contain reserved characters in SQL, mainly '. When I try to pass the text that contains a ' in txtDescription to an SQL statement in my VBA Code (I'm using ADO) I get a "Syntax error (Missing Operator) in query expression: ....." error message.
My question is should I
a) have a procedure remove all reserve characters from the string before I pass it to a SQL statement.
b) have a procedure add a ' before any reserved character in the string before passing it to an SQL statment.
c) give an error to the user telling them they cannot use certain characters.
d) answer the problem another way, ie someone smarter showing me the correct way to get around this problem.
any help would be greatly appreciated.
thanks,
kgk
My problem is I have a text field(txtDescription) on a form that may contain reserved characters in SQL, mainly '. When I try to pass the text that contains a ' in txtDescription to an SQL statement in my VBA Code (I'm using ADO) I get a "Syntax error (Missing Operator) in query expression: ....." error message.
My question is should I
a) have a procedure remove all reserve characters from the string before I pass it to a SQL statement.
b) have a procedure add a ' before any reserved character in the string before passing it to an SQL statment.
c) give an error to the user telling them they cannot use certain characters.
d) answer the problem another way, ie someone smarter showing me the correct way to get around this problem.
any help would be greatly appreciated.
thanks,
kgk