Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3094
  • Last Modified:

Embed Google dynamic map on Access form

Google has apparently changed their API for embedding maps. On a Access 2010 I've tried to modify my old map-address function but with no success unfortunately . Is this no longer possible to embed ? (the API key has been left out in the function listing below :)

I'm calling the function with:
Me.WebBrowserMap.Navigate ShowAddressOnMap(Me!Address, Me!PostalCode & " " & Me!City, True)

Function ShowAddressOnMap(StreetAddr As String, CityAddr As String, bEmbed As Boolean) As String
    Dim tmpStr As String
    Dim tmpStr2 As String
    Dim shellcmd As String
   
    tmpStr = "https://www.google.com/maps/embed/v1/place?key={API_Key}&q="
    tmpStr2 = Replace(Replace(Trim(StreetAddr), "  ", " "), " ", "+")
    tmpStr = tmpStr & tmpStr2 & ",+" & Replace(Trim(CityAddr), " ", "+")
   
    Debug.Print tmpStr
    If bEmbed = True Then
        ShowAddressOnMap = tmpStr
    Else
        shellcmd = "C:\Program Files\Internet Explorer\iexplore.exe " & tmpStr
        Shell shellcmd, vbNormalFocus
        ShowAddressOnMap = ""
    End If
End Function
0
Bojerne
Asked:
Bojerne
1 Solution
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Many people just use a WebBrowser, and then use the URL method to show the map. To do that, add a WebBrowser control to your form, and then set the .Navigate property of that control:

Me.MyWebBrowserControl.Object.Navigate = "Full URL for location"

This site seems to list all the parameters you can include in that URL:

http://querystring.org/google-maps-query-string-parameters/
0
 
BojerneAuthor Commented:
Thanks Scott - the link made me realise I had an "embed" parameter in the function (not shown above) - after removing the "embed" paramter it Works ok again :)
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now