Re: Insert spaces into String
- From: "Sandybam via AccessMonster.com" <u19465@uwe>
- Date: Fri, 10 Mar 2006 14:45:36 GMT
Fred,
Thank you for your feedback. As I indicated to Ken, I am learning code as
problems arise and as I inherit bad data as I did with this. I appreciate
your clear step-by-step instructions.
Sandy
fredg wrote:
I have a data set where all of the spaces have been removed and no common[quoted text clipped - 5 lines]
delimiter except for a capital letter for each new word. For example:
Thank you for your help.
Sandy
Why would you first remove the spaces and now want to add them back?
Place the following User Defined function in a new Module:
Function PlaceSpaces(FieldIn As String) As String
Dim strNew As String
Dim intX As Integer
Dim intY As Integer
strNew = Left(FieldIn, 1)
For intX = 2 To Len(FieldIn)
intY = Asc(Mid(FieldIn, intX, 1))
If intY >= 65 And intY <= 90 Then
strNew = strNew & Chr(32) & Chr(intY)
Else
strNew = strNew & Chr(intY)
End If
Next intX
PlaceSpaces = strNew
End Function
=========
In a query, add a new column:
NewName:PlaceSpaces([OriginalFieldName])
as criteria on the OriginalFieldName field, write:
Is Not Null
By the way, what do you want to do about names such as
McDonaldBusinessCenter or ABCHomeSupplies, O'BrienMedicalCenter, and
vanderMeerAndSonsSuppyCo.?
--
Sandy
Message posted via http://www.accessmonster.com
.
- References:
- Insert spaces into String
- From: Sandybam
- Re: Insert spaces into String
- From: fredg
- Insert spaces into String
- Prev by Date: DUPLICATE QUERY results
- Next by Date: Re: SQL too long?
- Previous by thread: Re: Insert spaces into String
- Next by thread: RE: Insert spaces into String
- Index(es):
Relevant Pages
|