javascript error when invoking bingmaps

Posted on 2016-11-26
Last Modified: 2016-12-10
I had this question after viewing javascript (?) could not complete the operation  due to error 80020101.

I have a working function which I had to upgrade to include additional functionality. Now  I am experiencing a systematic 800xxx error as I am invoking it. The source html page it attached and original code, sourced  from microsoft:

var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
    credentials: 'Your Bing Maps Key',
    center: new Microsoft.Maps.Location(47.60357, -122.32945)
var center = map.getCenter();
var pushpin = new Microsoft.Maps.Pushpin(map.getCenter(), null);
var infobox = new Microsoft.Maps.Infobox(center, { title: 'Map Center',
    description: 'Seattle', visible: false });
Microsoft.Maps.Events.addHandler(pushpin, 'click', function () {
    infobox.setOptions({ visible: true });

Open in new window

Question by:jirdeaid
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
LVL 82

Accepted Solution

leakim971 earned 500 total points
ID: 41902598
I added a button on this page to help you test without MS Access.
Open the page in your browser and click on the button to test it before trying with MS Access.
<!DOCTYPE html>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<script type="text/javascript" src="" async defer></script>
		<script type="text/javascript">
			var map;

			function loadMapScenario() {
				var options = { credentials: "AtmgIDsskKTlLBNr_LUOcdlK9ZFu3ZPBCdN_o5OSIh01ShsuR4mmzZAuD3PvGyaQ", zoom:18 };
				map = new Microsoft.Maps.Map(document.getElementById("myMap"), options);

			function addPushpin(strLatGPS, strLgtGPS, strLetraPushPin, strTitulo, strSubTitulo) {

				var center = new Microsoft.Maps.Location(strLatGPS*1, strLgtGPS*1);
				var pin = new Microsoft.Maps.Pushpin(center, {text: strLetraPushPin, title: strTitulo, subTitle: strSubTitulo}); 
				addInfobox(strTitulo, strSubTitulo);

				function addInfobox(infoTitle, infoContent) {
					var infobox = new Microsoft.Maps.Infobox(center, { title: infoTitle, description: infoContent, visible: false });
					Microsoft.Maps.Events.addHandler(pin, 'click', function () {
						infobox.setOptions({ visible: true });

		<button id="button1" onclick="addPushpin(11,-15,'X','PDA.36G017','Fonte');">PUSH PIN</button>
		<div id="myMap" style="width: 100vw; height: 100vh;"></div>

Open in new window


Author Comment

ID: 41902606

the pushpin is there and the add on text as well....

I'll move it to the main db now, removing the pushpin by commenting it and will come back in a minute...
LVL 82

Expert Comment

ID: 41902609
removing the pushpin by commenting it

you mean the button line 37, right ? ;^^
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users


Author Comment

ID: 41902613
YES! (I am so thrilled with your help that I am typing the wrong words...

Author Comment

ID: 41902619
strange ---

(I deleted the push button line as the button kept showing in spite of the double slash at the beginning of the line (I think that's the way to comment)

but then restarted the 800xxx problem

after telling OK it continued and correctly showed the pushpin. clicking on the pin it shows the infobox but its content is the same as the title and subtitle of the pin.

my data is:

InfoTit:teste título
Infodetail:teste detalhe mas com mais palavras

and the code to invoke is:

    strLetraPushPin = Forms![_commonVariables]![letraPushPin]
    strTitulo = Forms![_commonVariables]![titulo]
    strSubTitulo = Forms![_commonVariables]![subtitulo]
    strInfoTitulo = "teste título"
    strInfoDetalhe = "teste detalhe mas com mais palavras"
    Debug.Print "lat:" & strLatGPS
    Debug.Print "lon:" & strLgtGPS
    Debug.Print "letra:" & strLetraPushPin
    Debug.Print "tit:" & strTitulo
    Debug.Print "subtit:" & strSubTitulo
    Debug.Print "InfoTit:" & strInfoTitulo
    Debug.Print "Infodetail:" & strInfoDetalhe
    'mostrar o pushpin
    Debug.Print strLatGPS & " / " & strLgtGPS & "/" & strLetraPushPin & "/" & strTitulo & "/" & strSubTitulo
    Debug.Print Now()
    Do While m_WebBrowser.ReadyState <> READYSTATE_COMPLETE
    Debug.Print Now()
    InvokeJavaScript "addPushpin(" + strLatGPS + ", " + strLgtGPS + " ,'" + strLetraPushPin + "','" + strTitulo + "' ,'" + strSubTitulo + "');"
    InvokeJavaScript "addInfoBox(" + strInfoTitulo + ", " + strInfoDetalhe + " );"
LVL 82

Expert Comment

ID: 41902628
you was on a previous "test", that happen to me a lot
just be sure to close windows , stop debug/execution before  trying again.
you currently have nothing to change on Access and you test it on your browser

Author Comment

ID: 41902629
ah. ok
But on the normal browser it was working PERFECTLY as I told you.

when I pressed the push it was WORKING!

only then I deleted the button, moved to access and invoked from it...
LVL 82

Expert Comment

ID: 41902631
just try again

Author Comment

ID: 41902632

Author Comment

ID: 41902634
it really works


however, in the code you sent me I do not find how you do invoke the add infobox with its specific parameters (title/detail)
LVL 82

Expert Comment

ID: 41902637
this addInfobox(strTitulo, strSubTitulo);
call this function addInfobox(infoTitle, infoContent) {
using the same strTitulo, strSubTitulo as the pin
by default the infobox is not visible be cause this part : , visible: false });
when we click on the pin because of this : Microsoft.Maps.Events.addHandler(pin, 'click',
we show the infoxbox with this : infobox.setOptions({ visible: true });

if you want to set the infobox visible and not on click on the pin, the code need to be update

Author Comment

ID: 41902645
no.. behaviour is perfect.

So, I need to include 2 additional parameters in the addpushpin. now I understand better.

I have edited the map.html and sending in to you and now I think I can go back to the access code to test.

but I need to shutdown for some hours now as electricity is going to be cut off...

Author Closing Comment

ID: 41902849
Thanks a LOT! it is working perfectly inside ms/access - I now need to improve my own title/subtitle generation algorithm (for the infobox as well) and prepare for the next challenge, for which I will ask a related question, hopefully in a few hours.

BTW following your suggestion, I could ftp the map.html to my site. but now I wonder what would be the url to use, so I am putting a related question on this

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using, I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month10 days, 18 hours left to enroll

632 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