Mendip Data Systems

Database apps for businesses, schools and developers

* Required

Code Samples                                                Page 3 (of 3)    

iStock_000002894402Medium iStock_000005251211Large-LOW-RES american-coffee-colleagues-1376871 education tools

To provide feedback on a code sample, please enter your name, e-mail address and company (optional) below, add your comment and press the submit button. Thanks

All code samples are free to download and free to use in your own applications providing any copyright notices are included without any changes made.


All code will work in both 32-bit and 64-bit Access unless stated otherwise.


We do not give the same support to these code samples as for our commercial programs. However, please contact us if you have questions or suggestions for improvements.

If you found this site useful, please consider giving a donation to help offset the costs in keeping it running. Thanks.

Get User Name

Updated 12/09/2018

This describes 3 different methods of getting the current user name using VBA and compares the effectiveness of each method


More Details ...

Progress Bar

Updated 03/07/2017

This is a simple but effective progress bar for use in Access forms


More Details ...

Check Procedure Exists

Updated 03/07/2017

This article contains code to check if a procedure exists in an Access project


More Details ...

Get System Metrics

Updated 23/08/2018

The GetSystemMetrics API provides detailed information about system configuration and display settings. This article includes an example database for checking these values


More Details ...

Page 1 of 5

Go To Top 1 2 3 Return To Top
Page 3 of 3

Masked Input Box

Updated 28/08/2018

This is an updated version of the masked input box code originally written by Daniel Klann in 2003 for 32-bit Access only.


This updated version will work in both 32-bit and 64-bit Access


More Details ...

Get Value in Previous Record

Updated 03/12/2018

This shows a method for calculating the difference between values in the current record with those in the previous record. For example, this approach can be used for calculating energy consumption between meter readings.


More Details ...

Get Computer Name

Updated 08/12/2018

This describes 3 different methods of getting the current computer name using VBA and compares the effectiveness of each method


More Details ...

Access / Office 365 / Windows Version Check

Updated 18/12/2018

This is a simple utility to check the following:

a) Windows version & bitness (32/64-bit)

b) Access version & bitness

c) Whether Office 365 is installed


More Details ...

Negative Total Pages on Report

Updated 17/01/2019

If you have a VERY large report with more than the integer limit of 32767 pages, Access will display the total pages as a negative number

For example: Page 1 of -15440 pages


This article explains how to deal with that situation if it arises


More Details ...

Linked No Tables

Updated 05/02/2019

This DEMO application shows a method of running a split database where the connection strings cannot be viewed by end users


The front end (FE) database has no linked tables.

The FE file has 2 forms and 1 report none which have a permanent record source


The backend (BE) contains 1 ‘deep hidden’ table though it would work equally well with a standard table.

The record source for each FE object is set automatically to the BE table when the object is opened. It is cleared again when the object is closed


More Details ...

Application.UserControl property

Updated 29/11/2019

This shows how the UserControl property can be used to restrict how an application can be opened. Just one line of code is required in the Form_Load event of the startup form or in an autoexec macro.


Two examples are provided each containing a Starter app and a Main app:

a)    BlockDBOpenDirect

      - the Main app can be opened via the Starter app but cannot be run directly.

b)   BlockDBRemoteAccess

      - the Main app can be run directly but cannot be opened remotely using automation


Possible uses include using method b) in conjunction with other security measures such as disabling the shift bypass to help prevent hacking using automation.      


More Details ...

Centre Form On Screen

Updated 03/12/2020

Access provides a built in 'Center Form' feature as part of the form property sheet.

However this only centres the form in a horizontal direction.

The results can, at times, be visibly well off-centre.


Over the years, I have acquired various code samples that can be used to centre forms in both horizontal and vertical directions. However, I have also found that these do not all give identical results.


The outcomes depend on whether:

a) Access is maximised or not (occupies part of the screen only)

b) the navigation pane is maximised/minimised or hidden

b) the forms are popup or not


This article compares the outcomes from 4 different examples of centre form code      


More Details ...