Re: Fixed Address Function
- From: "sike11 via AccessMonster.com" <u21678@uwe>
- Date: Wed, 18 Oct 2006 09:00:10 GMT
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
.
- Follow-Ups:
- Re: Fixed Address Function
- From: John Spencer
- Re: Fixed Address Function
- 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
- Fixed Address Function
- Prev by Date: Exit query without a question
- Next by Date: Re: How to specify the data type of a field in a make-table query?
- Previous by thread: Re: Fixed Address Function
- Next by thread: Re: Fixed Address Function
- Index(es):
Relevant Pages
|