Geocoding here refers to getting a lat/lon from an address



Code:
Sub Geocode()
  Dim APP As MapPoint.Application
  Dim MAP As MapPoint.MAP
  Dim FAR As MapPoint.FindResults
  Dim LOC As MapPoint.Location
  
  Set APP = CreateObject("MapPoint.Application")
  APP.Visible = True
  Set MAP = APP.ActiveMap
  
  Dim rs As Recordset
  Set rs = CurrentDb.OpenRecordset("SELECT * FROM [Al's Beef]")


  Do Until rs.EOF = True
    Set FAR = MAP.FindAddressResults(rs("Address"), rs("City"), , rs("State"), rs("Zip"))
    Set LOC = FAR(1)
    rs.Edit
    rs!MP_Latitude = LOC.Latitude
    rs!MP_Longitude = LOC.Logitude
    rs!MP_MatchedTo = GetGeoFieldType(LOC.Type)
    rs!MP_Quality = GetGeoQuality(FAR.ResultsQuality)
    rs!MP_Address = LOC.StreetAddress.Value
    rs.Update
    rs.MoveNext
  Loop
End Sub
The code is fairly self-explanatory in my opinion, but there is an article with some humor describing what's going on here --

http://www.mapforums.com/access-vba-...int-28228.html

Code:
Sub CalculateDistances()
  Dim APP As MapPoint.Application
  Dim MAP As MapPoint.MAP
  Dim RTE As MapPoint.Route
  Dim LOC1, LOC2 As MapPoint.Location
  
  Set APP = CreateObject("MapPoint.Application")
  APP.Visible = True
  Set MAP = APP.ActiveMap
  Set RTE = MAP.ActiveRoute
  
  Dim rs1, rs2 As Recordset
  Set rs1 = CurrentDb.OpenRecordset("SELECT * FROM [Al's Beef]")
  Set rs2 = CurrentDb.OpenRecordset("SELECT * FROM [Al's Beef]")
  
  Dim sql As String
  sql = "CREATE TABLE AB_Distances (ID1 INTEGER, ID2 INTEGER, Distance Float)"
  CurrentDb.Execute sql


  Do Until rs1.EOF = True
    Set LOC1 = MAP.GetLocation(rs1("MP_Latitude"), rs1("MP_Longitude"))
    rs2.MoveFirst 'reset
    Do Until rs2.EOF = True
      If rs1("ID") <> rs2("ID") Then 'don't bother to calculate a store's distance to itself
        Set LOC2 = MAP.GetLocation(rs2("MP_Latitude"), rs2("MP_Longitude"))
        RTE.Waypoints.Add LOC1
        RTE.Waypoints.Add LOC2
        RTE.Calculate
        sql = "INSERT INTO AB_Distances (ID1, ID2, Distance) VALUES (" & rs1("ID") & ", " & rs2("ID") & ", " & RTE.Distance & ")"
        CurrentDb.Execute sql
      End If
      rs2.MoveNext
      RTE.Clear
    Loop
    rs1.MoveNext
  Loop
  MAP.Saved = True
  Debug.Print "finished"
End Sub
The related article -- http://www.mapforums.com/access-vba-...rix-28235.html