Anonymous
09-15-2003, 03:00 PM
In the application I am writing, I take a list of addresses from a customer database. I pass that list to MapPoint and optimize the route. Then, I need to read the individual addresses out of Mappoint so that I can write the addresses back to a text file in their new optimized order. With me so far?
So, here's my code that builds the route:
For intStopCounter = 0 To lstStops.ListCount - 1
oRte.Waypoints.Add oMap.FindAddressResults(stopData(intStopCounter).a dd1, _
stopData(intStopCounter).city, , _
stopData(intStopCounter).state, _
stopData(intStopCounter).zip)(1)
Next
and here's my export code.
intFileNumber = FreeFile
Open strFileName For Output As intFileNumber
For intStopCounter = 0 To oRte.Waypoints.Count - 1
strOut = Trim(Str(intStopCounter)) & "|"
strOut = oRte.Waypoints.Item(intStopCounter).Location.Stree tAddress.Street & "|"
strOut = oRte.Waypoints.Item(intStopCounter).Location.Stree tAddress.city & "|"
strOut = oRte.Waypoints.Item(intStopCounter).Location.Stree tAddress.Region & "|"
strOut = oRte.Waypoints.Item(intStopCounter).Location.Stree tAddress.PostalCode & "|"
strOut = Trim(Str(oRte.Waypoints.Item(intStopCounter).ListP osition))
Print #intFileNumber, strOut
Next
Close intFileNumber
I'm getting an error on the second line of the export, the line that tries to get the StreetAddress.Street value. The error I'm seeing is "The requested member of the collection does not exist. Use a valid name or index number."
Can someone tell me where I'm going wrong? Thanks in advance. I can't seem to figure out precisely what's wrong.
So, here's my code that builds the route:
For intStopCounter = 0 To lstStops.ListCount - 1
oRte.Waypoints.Add oMap.FindAddressResults(stopData(intStopCounter).a dd1, _
stopData(intStopCounter).city, , _
stopData(intStopCounter).state, _
stopData(intStopCounter).zip)(1)
Next
and here's my export code.
intFileNumber = FreeFile
Open strFileName For Output As intFileNumber
For intStopCounter = 0 To oRte.Waypoints.Count - 1
strOut = Trim(Str(intStopCounter)) & "|"
strOut = oRte.Waypoints.Item(intStopCounter).Location.Stree tAddress.Street & "|"
strOut = oRte.Waypoints.Item(intStopCounter).Location.Stree tAddress.city & "|"
strOut = oRte.Waypoints.Item(intStopCounter).Location.Stree tAddress.Region & "|"
strOut = oRte.Waypoints.Item(intStopCounter).Location.Stree tAddress.PostalCode & "|"
strOut = Trim(Str(oRte.Waypoints.Item(intStopCounter).ListP osition))
Print #intFileNumber, strOut
Next
Close intFileNumber
I'm getting an error on the second line of the export, the line that tries to get the StreetAddress.Street value. The error I'm seeing is "The requested member of the collection does not exist. Use a valid name or index number."
Can someone tell me where I'm going wrong? Thanks in advance. I can't seem to figure out precisely what's wrong.