Results 1 to 9 of 9
  1. #1
    Robert84 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Italy, Spain, Poland... i change place frequently
    Posts
    5

    How to insert google maps into a form with parameters from the DB

    Hello everyone!
    I work with a database containing information about different buildings. I need to represent this information spatially in a form. I tried a little bit with google maps, but unsuccesfuly so far. So this is why I kindly ask you for help. This is the issue:
    I need to do something like this:



    Click image for larger version. 

Name:	map.PNG 
Views:	43 
Size:	151.1 KB 
ID:	26469

    I did it in html and java script and it is easy, but the problem is how to insert it to the Access form? I used the web control on the form and with visual basic I tried to insert the html, but it doesn't work (is it even possible?). Or maybe there is another solution? I know I can insert a link to google maps with some parameters. But this way I cannot (or dont know how) change colours of markers and attach notes to them.
    If you could help me with this, I will be very grateful.
    Thank you!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    Insert the Internet control onto the form.
    then when it opens,set the URL on the control.

  3. #3
    Robert84 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Italy, Spain, Poland... i change place frequently
    Posts
    5
    Quote Originally Posted by ranman256 View Post
    Insert the Internet control onto the form.
    then when it opens,set the URL on the control.
    Thank you ranman256 for your reply. But the problem is that I dont want to paste the url from the internet. I want to insert html and java script to the form so it can show me the results.
    How to introduce in the form this kind of code (of course inserting the variables from the database):

    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>Google Maps Multiple Markers</title>
    <script src="http://maps.google.com/maps/api/js?sensor=false"
    type="text/javascript"></script>
    </head>
    <body>
    <div id="map" style="width: 1300px; height: 650px;"></div>


    <script type="text/javascript">
    var facilities = [
    ['Youth social center', 41.9807214, 2.81566040000007, 'some_text', 'red_MarkerA.png'],
    ['Cultural center Marfa. </br> Utilization rate: 69%', 41.9778625, 2.8068657999999687, 'info', 'orange_MarkerB.png'],
    ['Habitat office', 41.98848419999999, 2.8246775999999727, 'some_text2', 'green_MarkerC.png'],
    ['Migdia school', 41.9713573, 2.8209534000000076, 'info2', 'darkgreen_MarkerD.png'],
    ['Employment office', 41.97346, 2.8091400000000704, 'ocupacion', 'yellow_MarkerE.png']
    ];


    var map = new google.maps.Map(document.getElementById('map'), {
    zoom: 14,
    center: new google.maps.LatLng(41.975, 2.8228467999999793),
    mapTypeId: google.maps.MapTypeId.ROADMAP
    });


    var infowindow = new google.maps.InfoWindow();


    var marker, i;


    for (i = 0; i < facilities.length; i++) {
    marker = new google.maps.Marker({
    position: new google.maps.LatLng(facilities[i][1], facilities[i][2]),
    map: map,
    icon: (facilities[i][4])
    });



    google.maps.event.addListener(marker, 'click', (function(marker, i) {
    return function() {
    infowindow.setContent(facilities[i][0]);
    infowindow.open(map, marker);
    }
    })(marker, i));
    }
    </script>
    </body>
    </html>

  4. #4
    Robert84 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Italy, Spain, Poland... i change place frequently
    Posts
    5
    Does anyone can help with this?

  5. #5
    Robert84 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Italy, Spain, Poland... i change place frequently
    Posts
    5
    Maybe somebody could give me a hint how to introduce html code to the web browser control instead of URL of some external webpage?

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    not something I've dealt with to the level you require but the basics can be found here

    https://support.office.com/en-us/art...6-eb7660c1fd53

    what I have done in the past is go to the webpage, set the parameters required, then copy the URL as a template and understand how it works

    I can then replace/create new parameters as required

  7. #7
    Robert84 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Italy, Spain, Poland... i change place frequently
    Posts
    5
    Quote Originally Posted by Ajax View Post
    not something I've dealt with to the level you require but the basics can be found here

    https://support.office.com/en-us/art...6-eb7660c1fd53

    what I have done in the past is go to the webpage, set the parameters required, then copy the URL as a template and understand how it works

    I can then replace/create new parameters as required
    Thanks Ajax for your help. I planned to do it another way, but I think your idea with decoding the URL will be better. I don't know much about that but I will try. I'm just not sure if it is possible to send all parameters for google maps via URL?

    Thanks a lot Ajax, and if anyone can add something to the topis - more than welcome.

  8. #8
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    there are also googlemap api's that can be used as well in vba - again not sure if they meet your requirements but here is a link to get you started

    https://developers.google.com/maps/

    There is not much that can't be done in vba that can be done in javascript etc.

  9. #9
    Join Date
    Sep 2017
    Posts
    1
    How about writing a vba script in access to write a temporary html file in your c:\temp folder and then point to the file using file://c:/temp/tempmap.htm in the address field of the web browsercontrol.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 01-26-2016, 11:06 AM
  2. Removing Google Maps Feature from a Form
    By Deggsy in forum Forms
    Replies: 11
    Last Post: 05-22-2015, 04:50 AM
  3. Replies: 1
    Last Post: 05-19-2015, 01:59 AM
  4. Google maps XML
    By Ruegen in forum Programming
    Replies: 4
    Last Post: 03-05-2015, 07:53 PM
  5. Google maps from form
    By JeroenMioch in forum Programming
    Replies: 11
    Last Post: 03-04-2014, 10:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums