how to link the google maps with access 2003?

  • Thread starter Mohamed Gharabli
  • Start date
M

Mohamed Gharabli

hi all,

i have a ms access database and i want to like it with google maps. and i
have to let the use to zoom in and zoom out.

please advice
 
A

a a r o n . k e m p f

I do this with static maps and SQL Server reporting services all the
times.. I basically just go and concatenate the URL and then I embed
the picture into my reports
 
W

Wayne-I-M

Hi

It's very easy to link google maps with access - from a form.
But you need to give more information before anyone will be able to offer
advice.

You need to provide....
What do you want to do with the google map?
eg. Just a point from a zip code in a text box, a from/to directions on the
maps, etc

Also (most important - as you need to specificy this in the UHT section of
the call from access) what part of the world do you want to cover in the map.

PLEASE DO NOT POST YOUR ADDRESS HERE just a general area will do, eg, North
USA, South Italy, Rome, NZ south Island, etc.

Note that post code/zip code find feature in an access call to google maps
will not work anywhere outside the USA, Europe, Australia, NZ.

If you want to the map to be of a certain (variable) size when it opens it
is slightly more complex but it can be done.
etc
etc

So please supply some more information about what it is you are trying to
get as the end result and then many people on the forum will be able to offer
help
 
W

Wayne-I-M

Arron
You have given the wrong answer (again). You can not alter the UTC call in
a report so you can't (as the OP wants) zoom in and out on google maps in a
report.

Also SQL server can not implement UTC codes by itself, they must be called,
thought you would have known that ???
 
W

Wayne-I-M

Hi Mohamed

here is a copy of an answer I gave a while ago to the same type of question
It this is not what you're looking for post back and I (and other on this
forum) will try to help

I came up with this code myself so there maybe better methods (almost
certainly) around but you are free to use this code if you want

Good luck


________________________________________________

Create a new form in design view.
Put 1 button on it (call it butGMaps ). Put a text box on the form (call
it txtCodesPostle).


Load this into the OnClick event of butGMaps


Private Sub butGMaps _Click()
Dim MyHyperlink As String
Dim strGoogleLoaction As String


strGoogleLoaction = Replace([txtCodesPostale], " ", "+")
MyHyperlink
="http://maps.google.co.uk/maps?g=q&hl=en&geocode=&time=&date=&ttype=&q=" &
strGoogleLoaction & "&ie=
UTF8&ll=45.447125,6.978335&spn=0.012796,0.043087&z=15"


Application.FollowHyperlink MyHyperlink
End Sub


As you can see this is almost the same as I posted to you in another post.
But (again following Larry Linson’s advice) you would be better understanding
this code – so you can create your own.


So lets break down the code and work out how to create your own Google Maps
pointer.


This section just tells your application to do something when you click a
control (in this case butGMaps )
Private Sub butGMaps _Click()


This section is used to define the 2 variables. Dims are used to dinfine
variables and can be used elsewhere in the form (or in the application if
used in a public module)
Dim MyHyperlink As String
Dim strGoogleLoaction As String
So MyHyperlink and strGoogleLoaction can be changed (which is what variable
means in English – I may wrong about the translation. If I am someone else
will tell you)


This section tells your application to “follow†(go to) the place that you
have declared in your DIM variable
Application.FollowHyperlink MyHyperlink


This is the section that some people who are new to Access and Google Maps
have problems with
strGoogleLoaction = Replace([txtCodesPostale], " ", "+")
MyHyperlink
="http://maps.google.co.uk/maps?g=q&hl=en&geocode=&time=&date=&ttype=&q=" &
strGoogleLoaction & "&ie=
UTF8&ll=45.447125,6.978335&spn=0.012796,0.043087&z=15"


So we can break it down
strGoogleLoaction = Replace([txtCodesPostale], " ", "+")
This section replaces spaces (if there are any) with a + sign. This is
important as HTTP code (like used in Google Maps) will replace spaces with %
and not a +. But of course if there are no spaces then it will not do
anything


The next section (which in your code should all be on one line)
MyHyperlink
="http://maps.google.co.uk/maps?g=q&hl=en&geocode=&time=&date=&ttype=&q =" &
strGoogleLoaction & "&ie =
UTF8&ll=45.447125,6.978335&spn=0.012796,0.043087&z=15"


Is actually 4 sections
This section tells your application that this is the variable hyperlink
MyHyperlink =


This section open Google Maps (and a few other things like setting the
Geocoded time – for more info on this search Google on Geocode)
http://maps.google.co.uk/maps?g=q&hl=en&geocode=&time=&date=&ttype=&q


This section inserts the variable you have put into your text box
& strGoogleLoaction & "&


This section tells Google Maps “which†maps to open and at what scale
UTF8&ll=45.447125,6.978335&spn=0.012796,0.043087&z=15


THAT IS THE SECTION YOU NEED TO CHANGE if you need another map – "not" the
post code, zip code, codes postle, etc


So let say you live in the USA and you want to open a map of New York
Here is a cheat you can use that is very simple
If you open Google Maps and zoom in to the New York area then select the
"Link to this page" icon you can cut this
http://maps.google.co.uk/maps?hl=en&ie=UTF8&ll=40.784701,-73.861084&s...


You then cut out the section of this hyperlink “includeing and all after the
UFT" (Unicode Transformation Format) so you will get this
UTF8&ll=40.784701,-73.861084&spn=0.883826,2.757568&z=9


For Paris you would have this
UTF8&ll=48.819524,2.406006&spn=0.38429,1.378784&z=10


For the whole of Italy you would have this
UTF8&ll=42.455888,13.425293&spn=6.888257,22.060547&z=6


You need to add this section to your code so it looks like this (for New
York)


Private Sub butGMaps _Click()
Dim MyHyperlink As String
Dim strGoogleLoaction As String


strGoogleLoaction = Replace([txtCodesPostale], " ", "+")
MyHyperlink
="http://maps.google.co.uk/maps?g=q&hl=en&geocode=&time=&date=&ttype=&q=" &
strGoogleLoaction & "&ie=
UTF8&ll=40.784701,-73.861084&spn=0.883826,2.757568&z=9"


Application.FollowHyperlink MyHyperlink
End Sub


Or like this for paris
Private Sub butGMaps _Click()
Dim MyHyperlink As String
Dim strGoogleLoaction As String


strGoogleLoaction = Replace([txtCodesPostale], " ", "+")
MyHyperlink
="http://maps.google.co.uk/maps?g=q&hl=en&geocode=&time=&date=&ttype=&q=" &
strGoogleLoaction & "&ie=
UTF8&ll=48.819524,2.406006&spn=0.38429,1.378784&z=10"


Application.FollowHyperlink MyHyperlink
End Sub


Don’t forget that if you insert a post code, zip code, codes postle that is
not on the map it will not be seen as it is out side the area.


I hope this helps you with you application
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top