I have a variable declared as a string (Dim myComment as String)
myComment is equal to a cell on my spreadsheet. If the user types in that cell special characters such as quotations or single quotes, my code produces an syntax error. My code is trying to execute an SQL statement that includes the variable myComment. How do I get the SQL statement to execute?
For example: mySQL = "SELECT tblContractorDataOnly.FName FROM tblContractorDataOnly WHERE FName = "Mary's"). In this example "Mary's" is what is in the cell. myComment = "Mary's".
My SQL statement won't execute because of the single quote in Mary's.
What can I do?
Bookmarks