• ** There has been a recent site upgrade. Please clear your browser cache to avoid issues. **
  • New forum feature - post voting and best solution

    Check out this thread for the details: https://www.access-programmers.co.uk/forums/threads/new-forum-feature-post-voting-and-best-answer.314134/

    This new feature looks great to me! :)

  • We now have 3 forum themes

    Go for the default (light) theme, Shades of Grey or Shades of Blue. I just added the Blue one.

    The thread about it is here: https://www.access-programmers.co.uk/forums/threads/new-forum-theme-shades-of-blue.314136/

Application.UserControl property (1 Viewer)

Status
Not open for further replies.

isladogs

CID VIP
Local time
Today, 14:10
Joined
Jan 14, 2017
Messages
13,955
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
See https://docs.microsoft.com/en-us/office/vba/api/access.application.usercontrol

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.
Code:
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
Code:
If Application.UserControl =False Then Application.Quit

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

NOTE:
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.
 

Attachments

  • BlockDBOpenDirect.zip
    53.2 KB · Views: 44
  • BlockDBRemoteAccess.zip
    53.8 KB · Views: 44
Last edited:
Status
Not open for further replies.

Users who are viewing this thread

Top Bottom