How to save the data containing a single qoute?
or
How to eliminate the error for saving containing a Single Qoute? ( ' ) record?
Printable View
How to save the data containing a single qoute?
or
How to eliminate the error for saving containing a Single Qoute? ( ' ) record?
before passing your sql statement off to the database pass the statement to the following function to replace all occurences of individual single quotes with two single quotes:
Example:Code:Function SafeSQL(ByVal sCommandText As String) As String
SafeSQL = Replace$(sCommandText, "'","''")
End Function
Or:Code:sYourSqlStatementVar = SafeSQL(sYourSqlStatementVar)
Code:oRecordset.Open SafeSQL(YourSqlStatement)