Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 2 of 2

How to calculate distance between 2 location with vba

This is a discussion on How to calculate distance between 2 location with vba within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi , i have map point 2004 and access, and i want to take data in my, db 2 locations ...

  1. #1
    ifc
    ifc is offline Junior Member White Belt
    Join Date
    Feb 2004
    Posts
    3

    How to calculate distance between 2 location with vba

    Hi , i have map point 2004 and access, and i want to take data in my, db 2 locations and i want that map point calculate the distance and give me back the result so i can store it in my db.

    how can i automate this ???

    Thanks in advance

  2. #2
    ifc
    ifc is offline Junior Member White Belt
    Join Date
    Feb 2004
    Posts
    3
    Here is the code to do that (distance between 2 Postal Code (Zip) ) i finaly find it

    Code:
    Sub GetKm()
     Set oApp = New MapPoint.Application
     Set oMap = oApp.NewMap
     Set oLoc(1) = oMap.FindAddressResults("", "mons", , , "7000", "Belgium")
     Set oLoc(2) = oMap.FindAddressResults("", "namur", , , "5000", "Belgium")
        Set Loca(1) = oLoc(1).Item(1)
        Set Loca(2) = oLoc(2).Item(1)
        
        If Not oLoc(1) Is Nothing Then      'Check to see if the first address was found.
          If Not oLoc(2) Is Nothing Then      'Check to see if the second address was found
        Debug.Print oMap.Distance(Loca(1), Loca(2))
          End If
        End If
        Set oMap = Nothing
        Set oApp = Nothing
    End Sub

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to calculate distance between location and route ?
    By tontaegu in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-19-2005, 02:14 PM
  2. Calculate new location from lat/lon + bearing + distance
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 05-05-2004, 08:59 AM
  3. How to calculate distance using Mappoint and VB
    By digish in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 02-27-2004, 04:40 PM
  4. So how do i get it to calculate teh distance betwe....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 12-19-2001, 08:42 AM
  5. I would like to calculate the distance from multip....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-31-2001, 04:39 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66