Spaces in a multie value field.

aerosmith

Registered User.
Local time
Yesterday, 21:07
Joined
Jan 12, 2009
Messages
26
Afternoon,

Im trying to runt he following module on in a query so that it will remove spaces from a field that has 3 sets of values.

063, 683,091
spaces could be

063, 683,091
063,683 ,091
063, 683, 091


Public Function RemoveSpace(ByVal strData As String) As String
Dim intPosition As Integer
intPosition = InStr(1, strData, ", ")
If intPosition > 0 Then
RemoveSpace = Left(strData, intPosition - 1) & Mid(strData, intPosition + 2, Len(strData) - intPosition + 2)
Else
RemoveSpace = strData
End If
End Function

Nothing is getting amended :( if someone can help. id appreciate it.
 
Good morning ;)

I'm not a fan of multi-value fields, but have you tried the Replace function? It would be simpler. Either way, we'd need to know how you're using the function. It won't change anything by itself.
 
Code:
Public Function RemoveSpace(ByVal strData As String) As String
  RemoveSpace = Replace(strData, " ", "")
End Function
 

Users who are viewing this thread

Back
Top Bottom