Browser Control: Displaying Google Maps in Form (1 Viewer)

ironfelix717

Registered User.
Local time
Today, 09:10
Joined
Sep 20, 2019
Messages
193
Hi,

Last week i delved into trying to work with Google Maps in an Access form, where i discussed here: HERE

To summarize that endeavor: all i really require is being able A) use Maps in the form B) Point Maps to a specific coordinate. Item B can be done simply passing the cords to the source URL, in addition to a Maps API Key. The object that displays this data is a Active X control 'Microsoft Web Browser'.
This was working well, until i played around a bit more and find that control so hideously slow that its pointless -- which is why i return here.

The format for the URL is:
Code:
strURl = "https://maps.google.com/?q=" & _
         Lat & "+" & _
         Lng & "+" & _
         "+&t=h&output=embed" & _
         APIKEY

Which i reckon I don't even need the API key here, as i'm really just browsing Maps online - but regardless it loads.

The resultant url would be something such as
Code:
https://maps.google.com/?q=31+-55++&t=h&output=embedAIzaSyDHaNIV_d0d9jd4x2NfpI2zOag_Xwuk
Note: fake API key above

The Active X control loads this fine, but its slow and terrible to navigate and really doesn't work. I then considered using the "modern" 'Web Browser Control' that is offered in the Design pane.

Pointing both ControlSource and Navigate properties/methods to this URL result in the control displaying the classic "Cannot load page."

So, at this point, I am out of ideas. As i said, my goals are pretty straightforward: I just want to be able to use Maps inside Access with good performance, as well as point the Maps browser to a specific coordinate via VBA (through the URL - most likely).

Any ideas?
Thanks
 

ironfelix717

Registered User.
Local time
Today, 09:10
Joined
Sep 20, 2019
Messages
193
Update:

I was able to point the new control to the URL using this format:
Code:
Me.WebBrowser0.ControlSource = "=""" & strURL & """"

However, when Maps loads, i get a script error, which i can resolve by clicking no about 5 times (kind of annoying).
The browser seems to load OK but its still not nearly as optimal as a normal browser.

Curious to hear if there are any better solutions to embed Maps in a form. Thanks
 

isladogs

MVP / VIP
Local time
Today, 13:10
Joined
Jan 14, 2017
Messages
18,186
This link may help with your script error
Its the first item in the similar threads below. Always worth checking that feature

I mainly use static maps as you will know from my previous reply.
However I don't have the speed issue with dynamic maps that you described
 

ironfelix717

Registered User.
Local time
Today, 09:10
Joined
Sep 20, 2019
Messages
193
Colin,

Good info. I played around with the registry prior to making this post but was unsuccessful.

I ended up modifying the reg from the stackoverflow post in your link. This seemed to help performance slightly. Performance is bareable at this point but not nearly as smooth as an actual browser experience with Maps.

For suppressing the script errors, I think i fixed it by...
Code:
BrowserCtl.ControlSource = StrURL
BrowserCtl.Object.Silent = True

Or a combination of the two.

Thanks,
Regards
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 13:10
Joined
Jul 9, 2003
Messages
16,245
Question:-

When you click on the Google Map displayed in MS Access, can you extract the coordinates from the click point?
 

ironfelix717

Registered User.
Local time
Today, 09:10
Joined
Sep 20, 2019
Messages
193
Uncle Gizmo:

With the method i am using which is essentially justdisplaying Maps inside a browser control---not technically.

I can do 2 things:
1.) point the browser to a specific GPS cord. (by modifying the control source URL of the browser)
2.) get the GPS cord manually by clicking the map and copying the GPS cordinates that pop up in the Maps window.
 

Users who are viewing this thread

Top Bottom