Believe I have search high and low. Google Maps is giving a lot of error scripts as I am using MS Access WebBrowser. I have a MS Access form called frmClientLocation linked to frm ClientInformation. On the frmClientInformation there is the following fields that frmClientLocation uses to obtain client’s location or Geolocation.
PhysicalAddress (this is a multi line field)
City
ZipCode
This is the current VBA code I use in the Load_Event of frmClientLocation.
Private Sub Form_Load()
On Error GoTo Error_Handler
Dim strPhysicalAddress As String
Dim strCityTown As String
Dim strZipCode As String
Dim strURL As String
If IsNull(Me.PhysicalAddress) Then 'Ensure we have a physical address to get a map from
MsgBox "This record does not have a physical address", vbCritical
GoTo Error_Handler_Exit
End If
If IsNull(Me.CityTown) Then 'Ensure we have a zip code to get a map from
MsgBox "This record does not have a City/Town code", vbCritical
GoTo Error_Handler_Exit
End If
If IsNull(Me.ZipCode) Then 'Ensure we have a postal code to get a map from
MsgBox "This record does not have a postal code", vbCritical
GoTo Error_Handler_Exit
End If
strPhysicalAddress = Replace(Replace(Me.PhysicalAddress, vbCrLf, "+"), " ", "+") & "+"
strCityTown = Replace(Me.CityTown, " ", "+") & "+"
strZipCode = Replace(Me.ZipCode, " ", "") 'Remove any spaces from the postal code
strURL = "http://maps.google.com/maps?t=k&iwloc=A&hl=en&q=" & strPhysicalAddress & "+" & strCityTown & "+" & strZipCode
strURL = Replace(strURL, "++", "+")
Debug.Print strURL
Me.WebBrowser3.ControlSource = "=""" & strURL & """"
Error_Handler_Exit:
On Error Resume Next
Exit Sub
Error_Handler:
Resume Error_Handler_Exit
End Sub
As I said there is a lot of script errors. I have tried to change
"http://maps.google.com/maps?t=k&iwloc=A&hl=en&q=" & strPhysicalAddress & "+" & strCityTown & "+" & strZipCode
to
="https://www.openstreetmap.org/search?query=" & strPhysicalAddress & "+" & strCityTown & "+" & strZipCode
but get this