This function will take care of appostrophy when using SQL Statements. Note that when executing SQl
This function will take care of appostrophy when using SQL Statements. Note that when executing SQl Statements and you happen to be using a
Rate This function will take care of appostrophy when using SQL Statements. Note that when executing SQl
(1(1 Vote))
'Private declarations in the function
Dim strInString As String, IntPos As Integer, BlnFlg As Boolean
'strInString is the string to check for appostrophy
'IntPos is the position where an appostrophy is found
'BlnFlg is a boolean check that confirms the existance of an appostrophy
strInString = strInputString
'Reset Variables
BlnFlg = False
IntPos = 1
'Check if appostrophy exists and handle by introducting another
'appostrophy immediately
'Note that you check for appostrophy gradually within the string
Do While Not BlnFlg
'Check whether there is an appostrophy in the string
IntPos = InStr(IntPos, strInString, "'")
'If there is appostrophy then add another immediately
If IntPos <> 0 Then
strInString = Left(strInString, IntPos - 1) & "''" & _
Mid$(strInString,IntPos + 1)
IntPos = IntPos + 2
'If there isn't then be happy
Else
BlnFlg = True
End If
Loop
'Return the string with appropriate ammendment
AppendAppostrophy = strInString
End Function
This function will take care of appostrophy when using SQL Statements. Note that when executing SQl Comments
No comments yet — be the first to post one!
Post a Comment