Application.UserControl property (1 Viewer)

Not open for further replies.


Local time
Today, 16:34
Jan 14, 2017
This thread is designed to show 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.

It has been done partly in response to a recent thread by calvinie: Preventing user from opening accde directly but only via another access database

UserControl is a boolean property - True if opened direct, False if opened via another application using automation

Attached are two examples each containing a Starter app and a Main app, each with one form:
a) BlockDBOpenDirect (as per the original thread request) - the Main app can be opened via the Starter app but cannot be run directly.
If Application.UserControl =True Then Application.Quit

b) BlockDBRemoteAccess - the exact opposite - the Main app can be run directly but cannot be opened remotely using automation
If Application.UserControl =False Then Application.Quit

I hope one or other approach is useful to some of you

I have used method b) in conjunction with other security measures such as disabling the shift bypass to help prevent hacking using automation.

However, no Access database can EVER be made 100% secure
A capable and determined hacker can break any Access database given sufficient time and motivation.

Nevertheless, by erecting various barriers, it is certainly possible to make the process so difficult and time consuming that it isn't normally worth attempting.


    53.2 KB · Views: 58
    53.8 KB · Views: 55
Last edited:
Not open for further replies.

Users who are viewing this thread

Top Bottom