Version 3.1 First Published 22 Apr 2019 Last Updated 13 July 2023
UPDATED VERSION 30 May 2023 which uses the NEW Edge browser control (Microsoft 365 ONLY)
This utility can be used to determine your current geolocation in Access and display a map.
Using this app requires an Internet connection and a ‘free’ Google Maps API key
When the app is first opened, you will be prompted to enter an API key.
Follow the instructions on the form to obtain a API key from https://cloud.google.com/maps-platform
Google now requires billing information to be entered when obtaining API keys.
However there is a generous monthly free allowance and small/medium users of Google Map APIs should still be able to download various maps without incurring charges
Once you have entered a valid API key, click 'Get Current Location' on the main form.
A browser window will open a local HTML file called geolocal.html. You may be asked permission to obtain your location (unless this has already been granted).
If it appears, click the 'Allow Once' button within 3 seconds to grant permission
If you don't click the button in time, you will be offered further opportunities to do so.
NOTE: If the app 'hangs' and you have problems granting permission, see the update information below
Once you have granted permission, your current location should briefly be shown on the map and your latitude / longitude displayed.
The browser control window will then close automatically and the geolocation data will be shown together with a static map centred on that.
Reverse geocoding is also used to obtain a shortened address for the location which should be accurate to within a few metres.
a) The map centre can be 'nudged' in any direction using the 4 arrow buttons. Click the 'Home' button to return to the original location
b) Use the slider or textbox to adjust the zoom level between 1 and 20 where 1=whole earth ; 20 = rooftop
c) 4 types of map are available: roadmap / terrain / satellite / hybrid
NOTE: Each of the above changes causes a new static map to be downloaded
You can also view a dynamic full screen map online
IMPORTANT UPDATE 13 July 2023:
As mentioned above, the app uses a a local HTML file called geolocal.html
For security reasons, the new Edge browser control handles local HTML files differently to online HTML pages.
In order to load local HTML files, the domain https://msaccess must be used as a prefix before the local HTML file path. For example:
Unfortunately, local HTML files currently load more slowly and this can cause the app to 'hang'
Luckily there is a very simple fix:
Open Notepad using Run as an administrator and then open the text file called hosts which is located in the folder C:\Windows\System32\drivers\etc\
Now add the following line at the end of the file:
This configures the DNS to have the domain "msaccess" point to the local host with the result that local HTML files open much faster
Many thanks to @vxr who provided this solution in a post at Access World Forums
Click to download:
GetLocation v3.1 (zipped - approx 0.9 MB)
The zip file contains the Access file and 4 other items. Save each item to the same folder
The example database was created in Access 365 and Windows 10.
It will only work in Access 365 (both 32-bit & 64-bit) as this is the only version that has the new Edge browser control
1. You must switch on location services in Windows Settings
2. Your computer must contain a geosensor (all tablets / many laptops / not many desktops)
3. After long delays, a new web browser control based on Chromium Edge was released for Access 365 users during April 2023.
4. The original version of this utility was released in 2019. It used the legacy web browser control based on Internet Explorer
As a result, attempting to use the legacy browser control will report an error: Error - the geolocation service failed.
5. If you cannot get your location for the above reasons (or to do this for another location), you can obtain latitude & longitude data in other ways.
a) Open Google maps to your current location
b) Use GPS data from a mobile phone or other device with a geosensor
c) Use a Windows app such as Sensor List or Geolocator (free from the Windows Store)
d) Take a photo using your PC webcam then use the GPS data from the photo properties
Enter the values obtained using any of the above methods on the form then click 'Search'
6. The form includes an ActiveX slider control.
This will not work if you have disabled ActiveX completely in Access settings
An enhanced version of this utility is included in my UK Postal Address Finder application
It is used to locate the nearest postcodes for the current location (or any other geolocation).
That info is then used to find nearby places within a specified radius e.g. restaurants within 500 metres
For further details, please see the attached video (duration = 01:23)
Alternatively, click to download: Postcode Geolocation Video (zipped MP4 file - approx 1.7 MB)
See also this companion application: Get Geolocation From Photos
Please use the contact form below to let me know whether you found this article interesting/useful or if you have any questions/comments.
Please also consider making a donation towards the costs of maintaining this website. Thank you
Colin Riddington Mendip Data Systems Last Updated 13 July 2023
Return to Example Databases Page
Return to Top