This is probably a simple question, but I've got a brain block. I have a textbox field, txtMessage.text, that is read into a variable strMsg. This is used in an SQL Insert statement below (previously I just read txtMessage.text in this spot).
It saves just fine if there are no single quotes, i.e. apostrophes, in the text, but if there are, I get a syntax error. The user can't enter contractions because of this. How can I get this to allow single quotes? Thanks.
VB Code:
strSQL += CInt(txtInterviewerNum.Text) & ", " If blnIsCAS Then strSQL += "'" & strMsg & "', " & blnIsSent & ", " & blnIsNotSent & ")" Else strSQL += "#" & CDate(txtSvcDate.Text) & "#, '" strSQL += strMsg & "', " & blnIsSent & ", " & blnIsNotSent & ")" End If




Reply With Quote