Solved

Embed Google dynamic map on Access form

Posted on 2014-07-23
2
2,549 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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 …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

911 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now