Open Google or Bing Maps to coordinates in text box (1 Viewer)

Hdata

Registered User.
Local time
Today, 08:29
Joined
Sep 10, 2013
Messages
56
Hello and thank you for this forum

I have an access database where I can open a Bing Map from an address located in text boxes (street Address, City, State, zip, CountryorRegion.

My question is how could I revise this code to open a Bing Map or Google Map from Lat/Long Coordinates located in a textbox?


Function OpenMap(Address, City, State, Zip, CountryOrRegion)
Dim strAddress As String
strAddress = Nz(Address)
strAddress = strAddress & IIf(strAddress = "", "", ", ") & Nz(City)
strAddress = strAddress & IIf(strAddress = "", "", ", ") & Nz(State)
strAddress = strAddress & IIf(strAddress = "", "", ", ") & Nz(Zip)
strAddress = strAddress & IIf(strAddress = "", "", ", ") & Nz(CountryOrRegion)

If strAddress = "" Then
MsgBox "There is no address to map."
Else
Application.FollowHyperlink "http://maps.live.com/default.aspx?where1=" & strAddress
End If
End Function
 
Last edited:

plog

Banishment Pending
Local time
Today, 07:29
Joined
May 11, 2011
Messages
11,643
Do you understand that code at all? Ultimately you are building a URL. You need to check with live.com to see what a URL that uses lat\long should look like and then make your string produce something that conforms.
 

jdraw

Super Moderator
Staff member
Local time
Today, 08:29
Joined
Jan 23, 2006
Messages
15,378
??? Should your post's title be???

Open Google or Bing Maps from coordinates in text box
 

Hdata

Registered User.
Local time
Today, 08:29
Joined
Sep 10, 2013
Messages
56
Thank you, your suggestion for title is much better.
 

jdraw

Super Moderator
Staff member
Local time
Today, 08:29
Joined
Jan 23, 2006
Messages
15,378
I have a couple of older routines that work with Google Maps.

You need Lat and Long to 6 digits to get an address (at least that's what I've found).
I went to Google maps and zoomed in on Witchita, KA and clicked an address. Google tells me the Lat/Long.
I entered those values in my function and it returned the proper address-as below.

?AddrFromLatLong(URLEncode("37.678592,-97.379461"))
3140 W University St, Wichita, KS 67213, USA

I also did same with a Tunbridge Wells, UK address

?AddrFromLatLong(URLEncode("51.134881,0.239740"))
5 Harmony St, Tunbridge Wells TN4 8NS, UK

Good luck.
 

Users who are viewing this thread

Top Bottom