Solved

Embed Google dynamic map on Access form

Posted on 2014-07-23
2
2,492 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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

771 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

12 Experts available now in Live!

Get 1:1 Help Now