For the regulars of the forum you will have noticed the many questions I have had recently for almost non-msaccess things. At the bottom I will put a reference to some of them.
If I were to have a table of places I was wondering how to put them onto the globe, that is Google Earth.
Google first released Google Earth and a COM API. This meant that you could send your table of places to Google earth and have them show up there but meant that it was not in an Access form. You would have two things to look at.
I thought it would be good to take the google earth window and put it (parent it) with a form. I did not find any VBA examples but there are plenty of C# or VB.net examples.
One of my threads below gives a solution to that. I found that it was "clunky" and did not look good as (unlike MS Office programs) when you call google earth it fires VISIBLE and it is hard to hide this before parenting it with your form. Secondly it is a complicated method to resize.
Also you should know that the COM API is not being supported or further developed by Google.
If you do a search for googleearthairlines you will find an activeX control which does this as well.
Solution ".5" is that if you download the Google Earth Plugin for your webbrowser you can reference this and put an activex object (i think that is what I should say it is) on a form. I started here but found that things really did not work very well. This method is also unsupported by Google and you will notice that there are some private funtions that if you read the google forums they say may be taken away in the future (eg to start the API you need start_ so if google takes that away then that would be the end of the story). Form 1 shows a very simple example of this. I could not get the Balloons to work and the click event fires twice.
The final solution uses the web browser control. If you create your own HTML page you can put this into a web browser control and then call the plugin. This has been done in VB.NET and C# but I was not able to find an example in VBA.
I wrote my first HTML and JScript this week so forgive the mess of a HTML file that I have added. Oh and I first start VBA Access about 6 monthd ago as well so this is just a very basic example with no error trapping.
The biggest problem I had was two way communication to and from the web browser control and I hope that by posting my sample one of you experts will guide me a little further on this.
From my form to the webbrowser is not a problem I have the execScript function. But from the webbrowser there is no way in COM. My work around is that if I want to get something from the browser I use Jscript to navigate to a new page, with the page URL being the information that I need. I then capture this in the Beforenavigate event as the URL and then cancel the navigation.
.NET WebBrowser controls have a objectforscripting property which allows this to happen way better. I am guessing that there is someone that could whip up this control as a wrapper exposing this property to COM very very quickly. I would not need spoon feeding but I would have a thousand questions or need an example if someone wants to offer assistance.
here is that question
http://www.access-programmers.co.uk/forums/showthread.php?t=168101
I have hard coded a placemark and find address. Google earth API does not do Geocoding (turning an address into Lat/Long) you have to use Google Maps. The Placemark can only be added once as it adds an ID and you can onyl have one ID.
I reference the plugin in the the mdb so you will need to download this from google as well
http://code.google.com/apis/earth/
My todo is work out how to flyto multiple places. Google Earth does this in the form of a tour but the tour is not yet available to the API Plugin.
here the main questions I have had.
http://www.access-programmers.co.uk/forums/showthread.php?t=167295
http://www.access-programmers.co.uk/forums/showthread.php?t=167345
http://www.access-programmers.co.uk/forums/showthread.php?t=167846
**Edit - One thing which you should note is that you can load your .html page locally (ie. from c drive). It appears that in the long term (after testing) this is not the solution that Google wants according to its Terms of Service. In the terms you will see that the implementation of the API must be on a website that is publically available.**
**edit form 1 is left there as an example of how you once could initiate google earth api as a active x control. It does not work with the new version and I am not sure if you can anymore.
**October 2010 - this example is really getting old and I will soon put something in the database examples. It does not work out of the box. Further I made this with Internet Explorer 6...Access will crash if you use IE7 or IE8...you need to delete the Active X control and then put it there again which will then use your IE explorer version. Then name it the same name again in the activeX properties.
see this thread for an explanation until then http://www.access-programmers.co.uk/forums/showthread.php?p=1008218#post1008218
If I were to have a table of places I was wondering how to put them onto the globe, that is Google Earth.
Google first released Google Earth and a COM API. This meant that you could send your table of places to Google earth and have them show up there but meant that it was not in an Access form. You would have two things to look at.
I thought it would be good to take the google earth window and put it (parent it) with a form. I did not find any VBA examples but there are plenty of C# or VB.net examples.
One of my threads below gives a solution to that. I found that it was "clunky" and did not look good as (unlike MS Office programs) when you call google earth it fires VISIBLE and it is hard to hide this before parenting it with your form. Secondly it is a complicated method to resize.
Also you should know that the COM API is not being supported or further developed by Google.
If you do a search for googleearthairlines you will find an activeX control which does this as well.
Solution ".5" is that if you download the Google Earth Plugin for your webbrowser you can reference this and put an activex object (i think that is what I should say it is) on a form. I started here but found that things really did not work very well. This method is also unsupported by Google and you will notice that there are some private funtions that if you read the google forums they say may be taken away in the future (eg to start the API you need start_ so if google takes that away then that would be the end of the story). Form 1 shows a very simple example of this. I could not get the Balloons to work and the click event fires twice.
The final solution uses the web browser control. If you create your own HTML page you can put this into a web browser control and then call the plugin. This has been done in VB.NET and C# but I was not able to find an example in VBA.
I wrote my first HTML and JScript this week so forgive the mess of a HTML file that I have added. Oh and I first start VBA Access about 6 monthd ago as well so this is just a very basic example with no error trapping.
The biggest problem I had was two way communication to and from the web browser control and I hope that by posting my sample one of you experts will guide me a little further on this.
From my form to the webbrowser is not a problem I have the execScript function. But from the webbrowser there is no way in COM. My work around is that if I want to get something from the browser I use Jscript to navigate to a new page, with the page URL being the information that I need. I then capture this in the Beforenavigate event as the URL and then cancel the navigation.
.NET WebBrowser controls have a objectforscripting property which allows this to happen way better. I am guessing that there is someone that could whip up this control as a wrapper exposing this property to COM very very quickly. I would not need spoon feeding but I would have a thousand questions or need an example if someone wants to offer assistance.
here is that question
http://www.access-programmers.co.uk/forums/showthread.php?t=168101
I have hard coded a placemark and find address. Google earth API does not do Geocoding (turning an address into Lat/Long) you have to use Google Maps. The Placemark can only be added once as it adds an ID and you can onyl have one ID.
I reference the plugin in the the mdb so you will need to download this from google as well
http://code.google.com/apis/earth/
My todo is work out how to flyto multiple places. Google Earth does this in the form of a tour but the tour is not yet available to the API Plugin.
here the main questions I have had.
http://www.access-programmers.co.uk/forums/showthread.php?t=167295
http://www.access-programmers.co.uk/forums/showthread.php?t=167345
http://www.access-programmers.co.uk/forums/showthread.php?t=167846
**Edit - One thing which you should note is that you can load your .html page locally (ie. from c drive). It appears that in the long term (after testing) this is not the solution that Google wants according to its Terms of Service. In the terms you will see that the implementation of the API must be on a website that is publically available.**
**edit form 1 is left there as an example of how you once could initiate google earth api as a active x control. It does not work with the new version and I am not sure if you can anymore.
**October 2010 - this example is really getting old and I will soon put something in the database examples. It does not work out of the box. Further I made this with Internet Explorer 6...Access will crash if you use IE7 or IE8...you need to delete the Active X control and then put it there again which will then use your IE explorer version. Then name it the same name again in the activeX properties.
see this thread for an explanation until then http://www.access-programmers.co.uk/forums/showthread.php?p=1008218#post1008218
Attachments
Last edited: