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.
Updated 12/09/2018
This describes 3 different methods of getting the current user name using VBA and compares the effectiveness of each method
Updated 03/07/2017
Updated 03/07/2017
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
Page 1 of 5
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
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.
Updated 08/12/2018
This describes 3 different methods of getting the current computer name using VBA and compares the effectiveness of each method
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
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
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
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.
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