Solved

Embed Google dynamic map on Access form

Posted on 2014-07-23
2
2,717 Views
Last Modified: 2014-07-23
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
Comment
Question by:Bojerne
2 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 40213790
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
 
LVL 1

Author Comment

by:Bojerne
ID: 40213863
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question