Re: Fixed Address Function
- From: "John Spencer" <spencer@xxxxxxxxx>
- Date: Wed, 18 Oct 2006 07:45:00 -0400
Glad it is working. I think the problem with my routine was a mistaken
assumption on my part. If you wanted to strip out all returns and keep them
out, I should have modified the assignment lines to read. I would imagine
that your data was something like 99B <<new line>> Ashburton Road. The 99B
is probably still there, just above the Ashburton Road.
newAddress = newAddress & " " & strLine
'If you don't want the space between the items, then
'you can remove space that is being added
Next iCount
FixedAddress = Trim(newAddress) & " " & PostCode)
"sike11 via AccessMonster.com" <u21678@uwe> wrote in message
news:67f0e058b1a82@xxxxxx
Hi,
I tried both functions and both worked well. However, I noticed in John's
function that it stripped out the No. of the house or street so the
address
came out like below:
Ashburton Road instead of 99b Ashburton Road.
Thank you all for your help. My query is so much better now.
Regards,
Mary.
John Spencer wrote:
The first line is going to throw an error when address or PostCode is
Null.
So that is the first thing to change that line. Then the rest of the code
doesn't look functional to me, so I've rewritten it. This
Public Function FixedAddress(Address, PostCode) As String
'This will always return a string. If Address and Postcode
'are null it will return a zero length string - ""
'vbCrLf Carriage return/line feed
'vbTab - Tab character
'vbCr - Carriage Return
Dim newAddress As String
Dim AddressA As Variant
Dim iCount As Integer
Dim strLine As String
'populate an array with the lines
AddressA = Split(Address, vbCrLf)
'Combine the results
For iCount = LBound(AddressA) To UBound(AddressA)
'Strip out tab, linefeeds, and carriage returns
' You may want to modify this to put in a space or spaces in place
of
the
' character you are replacing. Otherwise, you could end up with
' data run together as in 1234(Tab)X Street would return 1234X
Street
strLine = Replace(AddressA(iCount), vbTab, "")
strLine = Replace(strLine, vbLf, "")
strLine = Replace(strLine, vbCr, "")
strLine=Replace(strLine," "," ") 'Two Spaces become one space
'combine the lines and add a carriagereturn and linefeed in
newAddress = newAddress & vbCrLf & strLine
Next iCount
FixedAddress = Trim(Mid(newAddress, 3) & " " & PostCode)
End Function
Hi John,[quoted text clipped - 44 lines]
Mary.
--
Message posted via http://www.accessmonster.com
.
- References:
- Fixed Address Function
- From: sike11 via AccessMonster.com
- Re: Fixed Address Function
- From: John Spencer
- Re: Fixed Address Function
- From: sike11 via AccessMonster.com
- Re: Fixed Address Function
- From: John Spencer
- Re: Fixed Address Function
- From: sike11 via AccessMonster.com
- Re: Fixed Address Function
- From: John Spencer
- Re: Fixed Address Function
- From: sike11 via AccessMonster.com
- Fixed Address Function
- Prev by Date: Re: apply calculation to group of records and append into the same
- Next by Date: Re: Action List
- Previous by thread: Re: Fixed Address Function
- Next by thread: Re: Removing the blanks
- Index(es):
Relevant Pages
|