timjfletcher
New member
- Local time
- Today, 19:58
- Joined
- Apr 5, 2011
- Messages
- 3
Hi everyone,
I am currently developing a unique property reference (flatnumber+housenumber+postcode) for use across various databases which may refer to addresses in different formats.
*running the code through Access 2007.
I have used the following code to extract just the numbers in a string:
This works really well, however I would to develop this to encorporate house/flat numbers that include a letter (ie 12a, 4b etc).
To add a complication to this I am currently using a field entitled 'address_line_1' which may contain the flat number and the house number (ie flat 4b 12 something street). At present the code produces the number 412, however I would like it to produce 4b12.
Other examples (problems):
Room 12c The Grange 33 acarcia avenue = 12c33
Flat 4 23b main road = 423b
Flat 6, 54a bridge road = 654a
Apartment 2a, 74 oak road = 2a74
Sorry if the next bit gets overly complex but I also need to takle alternative flat names, such as 'First Floor Flat' so that they become fff, 'Second Floor Flat' becomes sff, 'Ground Floor Flat' becomes gff and 'Basement Floor Flat' becomes bff.
*(I will probably need to build a lookup table for variations of these ie gnd = ground, 1st = first etc)
Therefore:
First floor flat 19 broad street = fff19
Ground floor flat 33 drive street = gff33
1st floor flat 19 broad street = fff19 (trickiest)
Is this possible?
Thanks in advance.
I am currently developing a unique property reference (flatnumber+housenumber+postcode) for use across various databases which may refer to addresses in different formats.
*running the code through Access 2007.
I have used the following code to extract just the numbers in a string:
Code:
Public Function fExtractNumeric(strInput) As String
' Returns the numeric characters within a string in
' sequence in which they are found within the string
Dim strResult As String, strCh As String
Dim intI As Integer
If Not IsNull(strInput) Then
For intI = 1 To Len(strInput)
strCh = Mid(strInput, intI, 1)
Select Case strCh
Case "0" To "9"
strResult = strResult & strCh
Case Else
End Select
Next intI
End If
fExtractNumeric = strResult
End Function
This works really well, however I would to develop this to encorporate house/flat numbers that include a letter (ie 12a, 4b etc).
To add a complication to this I am currently using a field entitled 'address_line_1' which may contain the flat number and the house number (ie flat 4b 12 something street). At present the code produces the number 412, however I would like it to produce 4b12.
Other examples (problems):
Room 12c The Grange 33 acarcia avenue = 12c33
Flat 4 23b main road = 423b
Flat 6, 54a bridge road = 654a
Apartment 2a, 74 oak road = 2a74
Sorry if the next bit gets overly complex but I also need to takle alternative flat names, such as 'First Floor Flat' so that they become fff, 'Second Floor Flat' becomes sff, 'Ground Floor Flat' becomes gff and 'Basement Floor Flat' becomes bff.
*(I will probably need to build a lookup table for variations of these ie gnd = ground, 1st = first etc)
Therefore:
First floor flat 19 broad street = fff19
Ground floor flat 33 drive street = gff33
1st floor flat 19 broad street = fff19 (trickiest)
Is this possible?
Thanks in advance.