×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Opening Google Maps gives Script error in Access web browser control (OSM no problem)

Opening Google Maps gives Script error in Access web browser control (OSM no problem)

Opening Google Maps gives Script error in Access web browser control (OSM no problem)

(OP)
My Microsoft Access form contains a web browser control that is populated by:

CODE

If Forms!frmPhotos!radOSM Then
  Forms!frmPhotos!WebBrowser.Navigate "localhost/LocatorO.php?lat=" & Me!fLatitude & "&lon=" & Me!fLongitude
Else
  Forms!frmPhotos!WebBrowser.Navigate "localhost/LocatorG.php?lat=" & Me!fLatitude & "&lon=" & Me!fLongitude
End If 
If radOSM is True then an OpenStreetMap is loaded, otherwise a Google map.

Both the OpenStreetMap and the Google map work fine if I load the URL directly into the browser:

CODE

localhost/LocatorG.php?lat=52.354473&lon=4.895552
localhost/LocatorO.php?lat=52.354473&lon=4.895552 
The OSM version also works fine in my Access form, but the Google Maps version gives a script error at Line 0, character 0 and the URL of Google Maps API src:

CODE

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <title>Locator</title>
    <style>#map {height:350px;width:350px;}</style>
    <style type='text/css'>#map {height:300px;width:300px;}</style>
    <script src='https://maps.googleapis.com/maps/api/js?key=[MyKey]'></script>
    <script type='text/javascript' src='misc/StyledMarker.js'></script>
    <script src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
  </head>
  <body id=body onload='initMap()'>
    <div id="map"></div>
    <script>
      var myLatLng = {lat: 52.354473, lng: 4.895552};
      function initMap() {
        var mapCanvas = document.getElementById('map');
        var mapOptions = {center:myLatLng,zoom:18,mapTypeId:google.maps.MapTypeId.ROADMAP,streetViewControl:false,mapTypeControl:false,scaleControl:false,zoomControl:false,fullscreenControl:false};
        var map = new google.maps.Map(mapCanvas,mapOptions);
        var marker = new StyledMarker({styleIcon:new StyledIcon(StyledIconTypes.MARKER,{color:'00ff00',text:'*'}),position:myLatLng,map:map});
        myLatLng = new google.maps.LatLng(52.354355,4.895760);
        marker = new StyledMarker({styleIcon:new StyledIcon(StyledIconTypes.MARKER,{color:'ff0000'}),position:myLatLng,map:map});
        myLatLng = new google.maps.LatLng(52.354355,4.895760);
        marker = new StyledMarker({styleIcon:new StyledIcon(StyledIconTypes.MARKER,{color:'ff0000'}),position:myLatLng,map:map});
        ........(more markers added from php)
      } 
    </script>
  </body>
</html> 

RE: Opening Google Maps gives Script error in Access web browser control (OSM no problem)

(OP)
I have now found the answer to my question over on StackOverflow. The basic problem is that, by default, Microsoft Access uses Internet Explorer 7 in de browser control, and Google Maps no longer supports that version. Access must be forced to use IE 11; that can be done by adding a couple of references to the Windows 10 Registry, for example via a batch file containing:

CODE

reg add "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" /v MSACCESS.EXE /t REG_DWORD /d 11000
reg add "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_DOCUMENT_COMPATIBLE_MODE" /v MSACCESS.EXE /t REG_DWORD /d 11000 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close