I need to strip out double quotes and carriage returns in my text fields on a form. Here's what I have for the function to replace " " with ' ':
'---------------------------
Function StripString( sPassed )
Dim sReturn, i, iLen, sChar, sLookFor
iLen = Len(sPassed)
sLookFor = Chr(34)
For i = 1 To iLen
sChar = Mid(sPassed,i,1)
If sChar = sLookFor Then
sReturn = sReturn & "'"
Else
sReturn = sReturn & sChar
End If
Next
StripString = sReturn
End Function
Is this right and how do I do the Chr(13) for the carriage return?
As always, I am grateful for all the help!
'---------------------------
Function StripString( sPassed )
Dim sReturn, i, iLen, sChar, sLookFor
iLen = Len(sPassed)
sLookFor = Chr(34)
For i = 1 To iLen
sChar = Mid(sPassed,i,1)
If sChar = sLookFor Then
sReturn = sReturn & "'"
Else
sReturn = sReturn & sChar
End If
Next
StripString = sReturn
End Function
Is this right and how do I do the Chr(13) for the carriage return?
As always, I am grateful for all the help!