Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove Spaces?

Status
Not open for further replies.
May 9, 2000
446
GB
Now i should remember this but its been a little while.... i have a field called [Name] on a report. Anyway i want to remove the spaces inbetween any of the characters in this field.... e.g. the name field may contain
'fred bloggs' but i want
'fedbloggs' all as one word....

Any help? Cheers

 
I made this some 5 years ago and never bothered to modify it to look by the book...However, it does its job so feel free to use it. It removes all spaces within a string.

Function killspace(x As String) As String
Dim i As Long
Dim lung As Long
Dim litera As String
Dim sir As String
Dim final As String
If Len(x) = 0 Then
Exit Function
Else
sir = x
lung = Len(sir)
For i = 1 To lung
If Left$(sir, 1) = " " Then
litera = ""
Else
litera = Left$(sir, 1)
End If
final = final & litera
sir = Right$(x, Len(x) - i)
Next i
killspace = final
End If
End Function
[pipe]
Daniel Vlas
Systems Consultant
danvlas@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top