I'm sure this is an extremely common problem. I looking of a best practice solution.
Users enter text in a form. I load the response into a variable... strUserText=me.UserText
Next, I save this response into a table using an variety of different SQL statements.
User's however enter text that includes both single and double quotes. What is the best practice to prevent these characters from causing SQL errors?
The user enters: It's my favorite day of the week
into a text box UserText
strSQL="UPDATE logShippingStatus SET ShippingStatus = '" & strUserText & "' WHERE Status.ID=680491;"
The apostrophe in "it's" breaks my SQL
Thanks in advance.