Public Function ExtractCharacter(WrongString As String, BadChar As String) As String
'This function will extract the all occurances of the character sent
'Declare local variables
Dim ClearedString As String
Dim CharPos As Long
Here's another one that allows you to look at a string and find multiple or single characters and then replace if found with multiple or single characters. I know this has been answered already above, but someone else may want this variation:
[tt]
Function fstrTran(ByVal sInString As String, _
sFindString As String, _
sReplaceString As String) As String
Dim iSpot As Integer, iCtr As Integer
Dim iCount As Integer
iCount = Len(sInString)
For iCtr = 1 To iCount
iSpot = InStr(1, sInString, sFindString)
If iSpot > 0 Then
sInString = Left(sInString, iSpot - 1) & _
sReplaceString & _
Mid(sInString, iSpot + Len(sFindString))
Else
Exit For
End If
Next
fstrTran = sInString
I don't know about your particular situation but Access reads two apostrophe's as one so having it replace all occurances of "'" with "''" works great.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.