halldo67
11-03-2009, 12:51 PM
I am trying to use Access to calculate distance measurements from new addresses (Longitude/Latitude unknown) to existing adresses (Longitude/Latitude known). I woluld like to use google maps to feed the longitude and latitude for the new address. I found the following code that will open Internet explorer and locate the new address on the map.
Private Sub Command14_Click()
Dim MyHyperlink As String, strGoogleLocation As String
Dim ie As Object, strTadd As String
'Create Addresses to review
strGoogleLocation = Me![Address] & "+" & Me![City] & "+" & Me![State] & "+" & Me![Zip]
'Create Link to navigate to
MyHyperlink = "http:"
MyHyperlink = MyHyperlink & "//maps.google.com/maps?q=" & strGoogleLocation
'Open Internet and create Map
Set ie = CreateObject("InternetExplorer.application")
ie.navigate MyHyperlink
ie.Visible = True
End Sub
When the map is created It will create a pointer icon. If you right click on the pointer icon and select What's Here? from the menu, the latitude and longitude will apear in the search window. This is the data that I am after, can anyone help me with the VBA code necessary to capture the longitude and latitude into the database without any manual efforts. I am not tied to google maps, I am just trying to get longitude and latitude without it being looked up.
Thanks in advance for any insight you may be able to share.
Halldo67
the member formerly known as just halldo!
Private Sub Command14_Click()
Dim MyHyperlink As String, strGoogleLocation As String
Dim ie As Object, strTadd As String
'Create Addresses to review
strGoogleLocation = Me![Address] & "+" & Me![City] & "+" & Me![State] & "+" & Me![Zip]
'Create Link to navigate to
MyHyperlink = "http:"
MyHyperlink = MyHyperlink & "//maps.google.com/maps?q=" & strGoogleLocation
'Open Internet and create Map
Set ie = CreateObject("InternetExplorer.application")
ie.navigate MyHyperlink
ie.Visible = True
End Sub
When the map is created It will create a pointer icon. If you right click on the pointer icon and select What's Here? from the menu, the latitude and longitude will apear in the search window. This is the data that I am after, can anyone help me with the VBA code necessary to capture the longitude and latitude into the database without any manual efforts. I am not tied to google maps, I am just trying to get longitude and latitude without it being looked up.
Thanks in advance for any insight you may be able to share.
Halldo67
the member formerly known as just halldo!