Link to home
Start Free TrialLog in
Avatar of wiswalld
wiswalldFlag for United States of America

asked on

Using google maps with microsoft access.

Using google maps with microsoft access. Anyone ever use this or understand this:

http://www.issociate.de/board/post/268098/Using_Google_Maps_In_MS_Access.html

I was good up until this point:

Save and close the new module naming it "Google Variables".


At this point, I will show you how Google Maps structures the URL that
retrieves a requested map.

Let's say you want to search for :

John Smith
111 West Gable Lane
Dayton, OH 45410

When you go to Google Maps at http://maps.google.com, you type in the
address and Google goes to...

"http://maps.google.com/maps?q=111+West+Gable+Lane+Dayton+OH +45410&iwloc=A&hl=en"

Now to pass this value to your new form, set your MyGoogleMapURL
variable to the above URL and open the new form like this:

MyGoogleMapURL =
"http://maps.google.com/maps?q=111+West+Gable+Lane+Dayton+OH +45410&iwloc=A&hl=en"
DoCmd.OpenForm "frmGoogleMap", acNormal

Obviously, you can parse the string value of the URL to any address of
your choosing.

Programmer's Note(s) And/Or Warnings:

If you're connecting to your new Google Maps form through a Citrix
connection, the opening of the Microsoft Web Browser control will crash
your MS Access database. This is because Google Maps will turn your
SpeedScreen setting on in Citrix, even if you have it set to Off, and
the combined running of both creates a GPF error.

You CAN, however, use a standard Remote Desktop Connection(RDC) or a
VNC connection with no resulting crashing of MS Access.

For additional business purposes, you can also have your MS Access
application target different types of businesses nearby (Example :
Schools) just by setting the URL string value to something like...

"http://maps.google.com/maps?q=schools+loc%3A+111+West+Gable +Lane+Dayton+OH+45410&f=l&hl=en"

I hope this helps you in your development process.
Avatar of wiswalld
wiswalld
Flag of United States of America image

ASKER

I created the form and named it frmGoogleMap and created the module. When I click it goes to nothing on the web browser. I also get a method or data member not found on ".WebBrowser0"
What I am trying to do is be able to enter an address in fields

Street
City
State
ZipCode

And go to a map of that. Anything you can give me would be great.
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
I just did this recently .... this worked for me:

Private Sub cmdMapJobLoc_Click()
       
   'NOTE: see this link for Google Map parms>> http://mapki.com/index.php?title=Google_Map_Parameters
   
    Dim tmpstr As String
    Dim tmpstr2 As String
    Dim shellcmd As String
   
    tmpstr = "http://maps.google.com/maps?q="
    tmpstr2 = Replace(Replace(Trim(Me.txtJobLocStAddr), "  ", " "), " ", "+")
    tmpstr = tmpstr & tmpstr2 & ",+" & Replace(Trim(Me.txtJobLocCityStateZip), " ", "+") ' & ",+” & [your state] & “””"
    'tmpstr = tmpstr & "&spn=0.005085,0.007693&t=k&hl=en"
    tmpstr = tmpstr & "&spn=0.005085,0.007693&t=m&hl=en"    ' m = map parameter, k = hybrid parameter
    shellcmd = "C:\Program Files\Internet Explorer\iexplore.exe " & tmpstr
   
    Shell shellcmd, vbNormalFocus
   

End Sub

------------------

mx
So what you did was create an active x control and insert a web browser and put htis in the on click?
No Active X control required.

The desired location to map is in text box
Me.txtJobLocStAddr

I click the button, and the browser opens.  My client uses this dozens of times daily.

A friend of mine who works with a LOT of web services and Access ... gave me the code ... which is not easy to find on the Google site.

mx
What about if I need to use more than one field? How would I write this?
Is it possible to create a copy of the map in the database?
"What about if I need to use more than one field? "

Not sure what you mean?

"Is it possible to create a copy of the map in the database?"

Well, you could store it as an image I suppose ... if you can get the image ... if that is what you mean?

mx
The desired location to map is in text box
Me.txtJobLocStAddr



What if I have four fields:
Street
City
State
Zip Code

I want it to look up using all fields.

What would be the easiest way to store the image.
ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial