Example Apps for Businesses, Schools & Developers

Screenshots

Click any image to view a larger version

APIInfo IEMap1 IEMap2 LocationMap GeolcationServiceFailed

Version 2.9       Last Updated 5 Feb 2022

This utility can be used to determine your current geolocation in Access and display a map.
The attached zip file contains an Access file and 4 other items.
Save each item to the same folder

Click to download : GetLocation v2.9    (zipped - approx 220 KB)



IMPORTANT NOTE: 
The geolocation code & map requires the use of a free Google Maps API key.

You can obtain your own free API key from https://cloud.google.com/maps-platform
You will need to enable THREE map APIs: Static Maps / Javascript Maps / Geocoding

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 and ask permission to obtain your location.

Click the 'Allow Once' button within 3 seconds to do so
Your current location should be shown on the map & your latitude / longitude displayed.

The browser window will then close & the geolocation data will be shown in Access together with a static map centred on that. The map can be nudged or zoomed as required.

Reverse geocoding is also used to obtain a shortened address for the location which should be accurate to within a few metres.

If you don't click the button in time, you will be offered further opportunities to do so.

The example database was created in Access 2010 32-bit and Windows 10.
However, it has been successfully used in all versions of Access from 2007 through to 365 (both 32-bit & 64-bit). It works in any version of Windows from Win7 SP1 onwards (but see point 3 below)



NOTE:
There are some caveats:

1.   You must switch on location services in Windows settings / Control Panel

2.   Your computer must contain a geosensor (all tablets / many laptops / not many desktops)

3.   It doesn't matter which browser is your default, Internet Explorer (IE) is always used by Access for
      browser related code. A new web browser control based on Chromium Edge is scheduled for release
      during 2022 (but it has already been delayed by almost two years).

4.   There was a bug affecting location services in Internet Explorer in the Windows 10 1803 update.
      When that update was first released, the browser window reported an error:
          Error - the geolocation service failed.

      I reported the bug to Microsoft in May 2018 and a fix was released for the 12 June Windows update
      (KB4284835).
      However the fix didn't work on all computers. I again informed Microsoft in June 2018.

      Windows 10 version 1809 update fixed the issue for most computers (but not all).

5.   The form includes an ActiveX slider control.
      This will not work if you have disabled ActiveX completely in Access settings



If you cannot get your location for any of the above reasons (or to do this for another location), you can obtain latitude & longitude data in other ways.

For example:
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'



FURTHER INFO:
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


Colin Riddington           Mendip Data Systems                 Last Updated 5 Feb 2022

Return to Example Databases Page Return to Top