I have managed to load all the postcode / zip files within a couple of seconds.. well in a fashion.
ok.. this is in short how I do it..
First get the count of the list.. ie. zipcount.
If this count is over say 5000 items.. I then split this array up.. ie..
Code:
If ca.ItemCount > 4999 Then
splitlist = True
splitby = 1000
For n = 0 To arraycount - 1 Step splitby
ReDim Preserve splitlistarray(c + 1)
If position = 1 Then
If searchby = "city" Then splitlistarray(c) = FDest.GetCityNameFromID(ca.Item(n))
If searchby = "street" Then splitlistarray(c) = FDest.GetStreetNameFromID(ca.Item(n))
If searchby = "postcode" Then splitlistarray(c) = FDest.GetZipCodeFromID(ca.Item(n))
End If
If position = 2 Then
If searchby = "city" Then splitlistarray(c) = FDest.GetStreetNameFromID(ca.Item(n))
If searchby = "street" Then splitlistarray(c) = FDest.GetCityNameFromID(ca.Item(n))
If searchby = "postcode" Then splitlistarray(c) = FDest.GetStreetNameFromID(ca.Item(n))
End If
If n > ProgressBar1.Value + pb Then ProgressBar1.Value = n : ProgressBar1.Refresh()
c = c + 1
Next
ctto = 1000
Else
ctto = ca.ItemCount
splitlist = False
End If
This then loads a new array up.. and at its greatest here in the uk 1.2 million postcodes.. it then only holds an array of 1000...
Then Say you want to start searching for a postcode.. you input S..
you then compare each value in the new array. Its then very easy to find which one contains the S your after, you then load just this array group and then search this array group for the needed one.
Using this way proves very fast..
Although the main downfall of using your own address list search is the fact the Destnators list is not in alpha order.. theres lots of pit falls, and I have come to thinking the only real way to do it is to embed the default address search dialog again.
hope this helps, if you want to check out the speed.. download a quick avi from
www.freedrive.co.uk/address.zip
CdR
p.s. also the avi taken is playing in the IDE, so its also faster than you see when its compiled ;-)
Bookmarks