Function FindSpecial(Field, ANSICode, ReplaceWith As String) As Variant
'Ansi Codes: 39= single quote
'to use, create an update query, with each field updating itself, ie
'Field1 UPDATE TO =FindSpecial([Field1],39,", ")
Dim x As Integer, y As Integer, strText As String, FindWhat As Variant, StrLength As Integer
Dim FindLen As Integer
FindWhat = ANSICode
FindLen = 1 'can only handle single characters at the moment
x = 1
If IsNull(Field) Then GoTo Find_Exit
strText = Field
If InStr(1, strText, Chr(FindWhat), vbBinaryCompare) Then 'is the special present?
StrLength = Len(strText)
Do Until x = 0
x = InStr(1, strText, Chr(FindWhat), vbBinaryCompare) 'find location
If x > 0 And Not IsNull(x) Then
strText = Left(strText, x - 1) & ReplaceWith & Mid(strText, x + FindLen, StrLength)
y = InStr(1, strText, " ", vbBinaryCompare) 'check for double spaces created by replace
If y > 0 And Not IsNull(y) Then
StrLength = Len(strText)
strText = Left(strText, y - 1) & " " & Mid(strText, y + 2, StrLength)
End If
End If
Loop 'check for more specials until x=0 (not found)
End If
If Trim(strText) = "" Then
FindSpecial = Null
Else
FindSpecial = Trim(strText)
End If
Exit Function
Find_Exit:
'undoes it all
FindSpecial = Field
End Function