Wayne-I-M
2008-01-23 02:17:23 UTC
How to open a Google Maps showing a location from your database.
Not sure if anyone is interested but it was asked a couple of days ago and I
didn’t know a good answer - just in case you have looked at my 1st attempt
:-) so I looked into it and came up with this. There will be other methods –
so this is just one.
To open Google Maps with the pointer placed on any location in your database.
Notes:
I assume you have a field called PostCode – if not then change the OnClick.
The field must contain a real postcode (the link will fail if the postcode
does not exist)
This will work for anywhere in the world – provided it has a UK postcode ;-)
Create a button on your form (called MapSearch) put this OnClick
Private Sub MapSearch _Click()
Dim MyHyperlink As String
Dim strGoogleLocation As String
strGoogleLocation = Replace([Postcode], " ", "+")
MyHyperlink =
"http://maps.google.co.uk/maps?g=q&hl=en&geocode=&time=&date=&ttype=&q=" &
strGoogleLocation & "&ie=
UTF8&ll=54.800685,-3.911133&spn=12.028783,29.619141&z=5&om=0"
Application.FollowHyperlink MyHyperlink
End Sub
IMPORTANT - this is all on one line
MyHyperlink =
"http://maps.google.co.uk/maps?g=q&hl=en&geocode=&time=&date=&ttype=&q=" &
strGoogleLoaction & "&ie=
UTF8&ll=54.800685,-3.911133&spn=12.028783,29.619141&z=5&om=0"
You can refine this code
This section opens the map to show the whole of the uk
UTF8&ll=54.800685,-3.911133&spn=12.028783,29.619141&z=5&om=0
So change this if you want the map to open showing another country. To find
out the code for this. Open Google Maps. Sign in for an account. Display
the map how you want it and then save the map. Google will provide you with
a hyperlink – copy this in to word (that’s what I did) then cut and paste the
“whole of the URL” after UFT.
Have fun.
Not sure if anyone is interested but it was asked a couple of days ago and I
didn’t know a good answer - just in case you have looked at my 1st attempt
:-) so I looked into it and came up with this. There will be other methods –
so this is just one.
To open Google Maps with the pointer placed on any location in your database.
Notes:
I assume you have a field called PostCode – if not then change the OnClick.
The field must contain a real postcode (the link will fail if the postcode
does not exist)
This will work for anywhere in the world – provided it has a UK postcode ;-)
Create a button on your form (called MapSearch) put this OnClick
Private Sub MapSearch _Click()
Dim MyHyperlink As String
Dim strGoogleLocation As String
strGoogleLocation = Replace([Postcode], " ", "+")
MyHyperlink =
"http://maps.google.co.uk/maps?g=q&hl=en&geocode=&time=&date=&ttype=&q=" &
strGoogleLocation & "&ie=
UTF8&ll=54.800685,-3.911133&spn=12.028783,29.619141&z=5&om=0"
Application.FollowHyperlink MyHyperlink
End Sub
IMPORTANT - this is all on one line
MyHyperlink =
"http://maps.google.co.uk/maps?g=q&hl=en&geocode=&time=&date=&ttype=&q=" &
strGoogleLoaction & "&ie=
UTF8&ll=54.800685,-3.911133&spn=12.028783,29.619141&z=5&om=0"
You can refine this code
This section opens the map to show the whole of the uk
UTF8&ll=54.800685,-3.911133&spn=12.028783,29.619141&z=5&om=0
So change this if you want the map to open showing another country. To find
out the code for this. Open Google Maps. Sign in for an account. Display
the map how you want it and then save the map. Google will provide you with
a hyperlink – copy this in to word (that’s what I did) then cut and paste the
“whole of the URL” after UFT.
Have fun.
--
Wayne
Manchester, England.
Wayne
Manchester, England.