michellecole
Programmer
I have a form with a text box entry field which allows the user to enter paragraph(s) of data which is used to build a SQL string to ultimately be saved to a memo field in the table. Before the record is saved, it is spell checked. But when executing the SQL statement with the data from the User input, if the user entered characters such as ";" or "'" or """, the query fails. The user needs the ability to enter grammatically correct sentences such as: "John's project ..." or "regarding the "Adjustments Report", ...".
Here is the code utilizing the user entered data in the field called [txtSummaryEntry]):
strSummary = [txtSummaryEntry].Value
sql = "INSERT INTO tblMonthlySummary_Projects ([DM_Summary) Values('" & strSummary & "');"
Since a "'" was entered by the user in the txtSummaryEntry field, I receive a "Syntax error (missing operator) in query expression..." run-time error messagebox.
Is there a work around to allow these characters to be included in the SQL string? If not, what are my options.
Thank you,
Here is the code utilizing the user entered data in the field called [txtSummaryEntry]):
strSummary = [txtSummaryEntry].Value
sql = "INSERT INTO tblMonthlySummary_Projects ([DM_Summary) Values('" & strSummary & "');"
Since a "'" was entered by the user in the txtSummaryEntry field, I receive a "Syntax error (missing operator) in query expression..." run-time error messagebox.
Is there a work around to allow these characters to be included in the SQL string? If not, what are my options.
Thank you,