Wednesday, October 28, 2009

Function Aphostrope

Public Function Apostrophe(sFieldString As String) As String
If InStr(sFieldString, "'") Then
Dim iLen As Integer
Dim ii As Integer
Dim apostr As Integer
iLen = Len(sFieldString)
ii = 1

Do While ii <= iLen
If MID(sFieldString, ii, 1) = "'" Then
apostr = ii
sFieldString = Left(sFieldString, apostr) & "'" & _
Right(sFieldString, iLen - apostr)
iLen = Len(sFieldString)
ii = ii + 1
End If
ii = ii + 1
Loop
End If

Apostrophe = sFieldString
End Function

0 comments: