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
  • 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 ? ;^^
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why


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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How can i get the length? 7 33
HTML5 Looping table certain Cell 11 42
JavaScript let vs var 5 26
innerHTML 7 19
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

772 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