Map Pin into Access Form

mikebrewer

Registered User.
Local time
Yesterday, 19:15
Joined
Sep 28, 2011
Messages
93
Hey guys,

I've been researching this for a bit and haven't come up with anything good but here is what I'm trying to do... I have an application where foreman setup jobs and I'd like them to do something like put a pin on a map and that would save lat/long to the database. I haven't been able to find a good way to integrate this and I'm not sure if anyone else has done something similar. The reason I'm looking for lat/long is because a lot of the time, where we are working doesn't have a real address yet so its not on the map.

I haven't been able to find an add-in or anything to import or link and I'm not sure the best way to do this... anyone have a suggestion?

Thanks!
 
So I've determined that really the only map that is even functional inside an access form is Bing. That is okay, except I can't figure out how to save a pushpin. I can put a pushpin on the map, I just don't know how to get access to read that location from the map.

I have a web browser control on the form that automatically loads up the bing maps and then can put a pushpin where I'd like. What I'd like to do is have a command button that would save the pushpin location to a table. Anyone done anything similar?
 
I think you will struggle to pull back the Lat/long from the push pin unless you can get to the API for the map display. I'm not saying it's impossible but I suspect mighty difficult.

I've really struggled(as in not yet achieved) to do the reverse - put multiple pins on a map just for display purposes. Especially as to embed the form in access removes a lot of the functionality.
 
sometimes someone share this db, google map, thanks for that guy you know who you are. maybe this can be of help to you.
 

Attachments

That is a really well presented example database - maybe if the author can be contacted we could put it in the example code forum?
 
This is awesomely done. I haven't even fully gotten into it quite yet but it looks fantastic so far. I'm going to mess around with this today and see if I can't get it solved for my use but from the 5 minutes I've spent so far, it has some awesome features.
 
Okay, so this is still awesome, I'm just having one problem. I continually get a script error on http://maps.google.com/maps-api-v3/api/js/23/5/onion.js. The only way out is to close program via task manager. All I've read is to change the version of the google maps api but I can't figure out how to do that one.

I've tried forcing the web browser control to use different versions of IE but that hasn't gotten me there yet and I tried changing the URL in the html file to add a version # but I couldn't get the URL right from what I was trying (or if could even change that). Not sure what else to try out?
 
Yes, it is. I'm pulling up form 5Clicking_Dragging_Polylines and then really just kind of dragging the map around for a minute, zoom in and out, etc. It doesn't happen right away but after a little clicking/dragging/zooming, I'll get the error. I'm using Access 2013, Windows 10 64 Bit as my PC
 
I'm using 2010. When I extract the mdb and all jpgs. I get an immediate overflow error in the command1_Click event of the StartForm?? I put a break point on the
Code:
Map.StartMap

I modified the code to prevent overflow (Dimmed MyError as Long) and added a msgbox to display any error (not only the 602 by the author)
Code:
Private Sub Command1_Click()
On Error GoTo ErrCatch
    Map.StartMap
    Map.GeocodeAddress address, All

    Exit Sub
ErrCatch:
    Dim MyError As Long 'Integer
    MyError = Err.Number - vbObjectError - 513
    
    If MyError = 602 Then
        MsgBox "The Address you entered could NOT be found." & vbNewLine & _
            "Please enter another address", vbOKOnly, "NO ADDRESS FOUND"
    Else
        MsgBox "Error  " & Err.Number & "  " & Err.Description
    End If
End Sub
and now get

Error 91 Object variable or With block variable not set

Is nobody else getting these errors?

I'd like to get this demo to work, so any advice would be much appreciated.
Thanks in advance.
 
jdraw,

You may want to check your references and make sure you have them all correctly set. I never received any errors. I'm assuming that Microsoft Internet Controls are required. I also have Microsoft Visual Basic for Applications Extensibility 5.3, Microsoft ActiveX Data Objects 2.7 Library, Microsoft Office 14.0 Access database engine Object Library, OLE Automation, Microsoft Access 14.0 Object Library and Visual Basic for Applications.
 
Thanks Mike.
Here's what I have (attached)


Also, just tried the accdb and had same error??????
 

Attachments

  • GoogleMapExampleRefs.jpg
    GoogleMapExampleRefs.jpg
    69.9 KB · Views: 304
You know.... I have no idea... I just tried it with your setup and it worked fine for me. Maybe try patching the system fully? Maybe it was built on a newer version than 2010 and you need a service pack? I'm kind of grasping at straws.
 
I'm chiming in as I am having a similar problem. This just started in the last week or two. It was working perfectly for years before this...

If I open a map viewer and add a point via the mapclick event and map.placemarker command, I can drag it to my heart's content. It will drag forever.

HOWEVER, if I perform a map.placemarker during the form on_load using hardcoded lat and lng, it will fail. After a few drags of the point I get the same script error on maps.google.com/maps-api-v3/api/js/23/5/onion.js as Mike Brewer.

I used the mapping demo linked below as a base to recreate the error. I have two forms, one that works (mapclick), the other does not (on_load).

HELP! :banghead:
 

Attachments

Unfortunately, it still errors out for me, even using your example. Mainly when I'm just re-adjusting the map, though. After I zoom in/out, re-center the map dot, etc. Then I'll get the error. If I just put a marker on the map and drag it around, it seems to work just fine. Unfortunately for me, I want them to adjust the map and then put a dot on it. I have to assume Google made a change and all I've read has to do with some version but I can't figure out how to change the version this code uses. I do love how well it works, though (when that darn error doesn't come up!)
 
Okay... so I've tried these numerous things to try and get by this...

In the html file, I changed this line:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

to this:

<meta http-equiv="X-UA-Compatible" content="IE=edge"; charset=iso-8859-1">


I then added/changing this key:

HKLM\Software\WOW6432Node\Microsoft\Internet Explorer\Main\FeatureControl\Feature_Browser_Emulation\

added REG_DWORD msaccess.exe with decimal values of 10001, 11999, 9999, 8888.

They all fail... just with my short tests it seems that 10001 or 11999 seem to work best. By best I mean that they seem to fail after the longest period of time of zooming, scrolling, etc. The only problem I see is that my tests have been only a few so the sample size is fairly small.

I know that doesn't help completely but hopefully we'll get there!
 
Update:

I tried opening the database attached by AAARGH in post 14.
I extracted both files to a trusted location.

I get an error (-2147024891) and Access Denied in both form 1 and form 2 when trying to run each?????

If I click Debug it goes to line with Map.StartMap in the Form_Load event???
 
after searching the net i finally found the conclusion on how to make this db work.
it has to do with Local Machine Zone Lockdown (LMZL). please google it.
to alleviate the problem, just create an entry in the registry, make exception to msaccess.exe, using regedit:

HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl
\FEATURE_LOCALMACHINE_LOCKDOWN\msaccess.exe= 0x00000000

also put googlemaps.html where your db resides (currentproject.path). do not alter it.
 
I have updated the registry as suggested by arnelgp. I get this error
Error -2147024891 on Line 20 Access is denied.

Here is related code
Code:
Private Sub Command1_Click()
10    On Error GoTo ErrCatch
20        Map.StartMap
30        Map.GeocodeAddress address, All

40        Exit Sub
ErrCatch:
          Dim MyError As Long 'Integer
50        MyError = Err.Number - vbObjectError - 513
          
60        If MyError = 602 Then
70            MsgBox "The Address you entered could NOT be found." & vbNewLine & _
                  "Please enter another address", vbOKOnly, "NO ADDRESS FOUND"
80        Else
90            Debug.Print "Error  " & Err.Number & " on Line " & Erl & "  " & Err.Description
100           MsgBox "Error  " & Err.Number & " on Line " & Erl & "  " & Err.Description, vbOKOnly

110       End If
End Sub

Anyone have ideas?
Is nobody else having trouble getting this to do anything?

UPDATE: I did find this info that may be useful to others. I replaced the original Command1_Click() event with the one in the UA thread. I now get a different Access is Denied message (see attached AccessDenied23Ja2016.jpg), but still no go. Seems it may be a change at Google that is root of the issue???
 

Attachments

  • lockdown.jpg
    lockdown.jpg
    96.8 KB · Views: 112
  • LocalsShowingAccessIsDenied.jpg
    LocalsShowingAccessIsDenied.jpg
    93.1 KB · Views: 115
  • AccessDenied23Jan2016.jpg
    AccessDenied23Jan2016.jpg
    43 KB · Views: 109
Last edited:
the only problem im encountering right now is script error (occasionally) when i hover over the map area.

another thing is there is a problem with ado 2.x, should fix this when you make reference to Microsoft ActiveX Data Objects 6.1.
 

Users who are viewing this thread

Back
Top Bottom