VB Code:
Public Function pc_ValidationStr(pi_strValue As Variant) As String
Dim StrValidation As String
Dim strValues As String
Dim lngCnt As Long
Dim lngStrLong As Long
On Error GoTo errH
StrValidation = ""
If TypeName(pi_strValue) = "String" Then
strValues = Trim(pi_strValue)
lngStrLong = Len(strValues)
If lngStrLong > 0 Then
For lngCnt = 1 To lngStrLong
If Mid(strValues, lngCnt, 1) = "'" Then
If Not Right(StrValidation, 1) = "'" Then
StrValidation = StrValidation & Mid(strValues, lngCnt, 1) & "'"
End If
Else
StrValidation = StrValidation & Mid(strValues, lngCnt, 1)
End If
Next
End If
End If
pc_ValidationStr = StrValidation
End Function