View Full Version : GETTING RID OF AMPERSAND (&) IN TEXTFLD


Rich_Lovina
09-02-2001, 05:00 AM
I have an INITIALS FIELD such that AB&CD Smith are couples. What is the expression to queryupdate COUPLES field to yes. Ive done this before but forgotten the expression.
I can filter to replace all & with +, and then use my initials splitter.Any ideas? Thanks in advance...SQL learner.

R. Hicks
09-02-2001, 09:07 AM
Here is a function I quickly wrote that can be called from an Update Query to do what you ask:

Public Function fReplaceAmpersands(strEntry As Variant) As String
Dim strTemp As String
Dim x As Integer
If IsNull(strEntry) Then Exit Function
For x = 1 To Len(strEntry)
&nbsp If Mid$(strEntry, x, 1) = "&" Then
&nbsp &nbsp strTemp = strTemp & "+"
&nbsp Else
&nbsp &nbsp strTemp = strTemp & Mid$(strEntry, x, 1)
&nbsp End If
Next x
fReplaceAmpersands = strTemp
End Function

HTH
RDH

[This message has been edited by R. Hicks (edited 09-02-2001).]