Integrate OSM into a MS Access form

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

I don’t have the knowledge to debug VBA, but I think it would be worth you reading the Nominatim Usage Policy. The geocoder offered on the OpenStreetMap.org main page is more of a demo and a tool for contributors to check things than for production use. The map tiles are also subject to a usage policy, for similar reasons.

There are a number of geocoders that use OSM data, some are self-hosted solutions and some are hosted by companies that charge a fee.

There is a similar situation with map tiles. Which can be displayed a few different ways introduction here.

All that being said – and I realise this is a bit of a faux pas on an OpenStreetMap forum – when the Microsoft documentation specifically mentions their own Bing maps, Bing might be the path of least resistance?

1 Like

Bing all so provide script errors. I will read Nominatim Usage Policy

Ok, I have read through Nominatim Usage Policy and links. I signed up with Rapidapi as this api provide a good free plan as I will never exceed calls and we are only 3 users which less then 5 seats. And provide reverse and forward geolocation.

Now for the code side how and where in my VBA code do I add this API. I have a Rapid Api