postal codes ... that is a good question
if so, you could create a table with the CORRECT city/cities for the
specified postal code ... sometimes the code may be right and the city
wrong -- other times, it may be the other way. Since you get this data
every month, it would be worthwhile to develop code to correct it.
Here is some code you can use to compare city names -- I have done this
on large tables with cities spelled differently and it works like a
champ to wade through the major problems
'~~~~~~~~~~~~~~~~~
'written by R_Cubed ... Rob Richards
'
Public Function fSoundex(Word As String) As String
Dim strCode As String
Dim strChar As String
Dim lngWordLength As Long
Dim strLastCode As String
Dim i As Long
'Grabs the first letter
strCode = UCase(Mid$(Word, 1, 1))
strLastCode = GetSoundCodeNumber(strCode)
'Stores the word length
lngWordLength = Len(Word)
'Continues the code, starting at the second letter
For i = 2 To lngWordLength
strChar = GetSoundCodeNumber(UCase(Mid$(Word, i, 1)))
' If adjacent numbers are the same,
' only count one of them
If Len(strChar) > 0 And strLastCode <> strChar Then
strCode = strCode & strChar
End If
strLastCode = strChar
Next
'Trim it down to a maximum of four characters...
fSoundex = Mid$(strCode, 1, 4)
'... but if it's less than four characters, pad
'it out with a bunch of zeros...
If Len(strCode) < 4 Then
fSoundex = fSoundex & String(4 - Len(strCode), "0")
End If
End Function
Private Function GetSoundCodeNumber(Character As String) As String
'Accepts a character and returns the
'appropriate number from the Soundex table
Select Case Character
Case "B", "F", "P", "V"
GetSoundCodeNumber = "1"
Case "C", "G", "J", "K", "Q", "S", "X", "Z"
GetSoundCodeNumber = "2"
Case "D", "T"
GetSoundCodeNumber = "3"
Case "L"
GetSoundCodeNumber = "4"
Case "M", "N"
GetSoundCodeNumber = "5"
Case "R"
GetSoundCodeNumber = "6"
End Select
End Function
'~~~~~~~~~~~~~~~~~
I would recommend creating a table with:
- zipID, autonumber
- zip, text, 5 (postalCode, text 10 if internt'l addresses)
- city, text, 30
- state, text 2
- soundex, text 10
when you get data, assume the zip/postal code is correct. Add ZipID to
your table and update it where the records match.
Another table you may want to create is for Regions
- RegionID, autonumber
- Region, text
and add RegionID to the Zips table -- this will enable you to group
records for areas.
I have a zip code db of the united states with > 42,000 records. It
also has latitude and longitude, so relative distances can be
calculated. If you want it, email me and I will send it to you.
(e-mail address removed)
Warm Regards,
Crystal
*
have an awesome day
*