How to kick users out of MS Access?

How to kick users out of MS Access?

Written by Mohit Rajora, In Business, Guides, Published On
October 1, 2022
, 110 Views

There’s no doubt that Microsoft is one of the topmost IT companies currently, This name and fame are only possible because Microsoft only serves its users with the best of services. For instance, the very brilliant series of Microsoft applications. One such application that is used by thousands of people on a daily basis is Microsoft Access. In this article, we are going to touch on that subject. Specifically, it’s a guide on how you can kick out a user from MS access.

What is MS Access?

Microsoft Access is a database management application by Microsoft that allows users to store data in something called “sheets”. These sheets are nothing but boxes arranged horizontally and vertically, waiting to be filled with values. Basically, you store data in form of rows and columns, which is called a table.

Before we started to discuss the steps to kick out a user out of MS Access, it was vital to know what MS Access actually is. Now that we have the pre-requisite knowledge, let’s proceed further. 

How to kick users out of MS Access?

How to kick users out of MS Access?

Whatever the reason might be, sometimes the owner of the database sort of regrets giving some users access to the database. It is then that people look for ways by which they can undo what they have done and just take back the user access from certain individuals. If you are looking for the same, let’s talk about User Permissions in MS Access, and that is going to approach the solution to your problem.

User Permissions

When you add a user to the MS Access file, you will always assign them a role. A role in database language is called permission. There are a total of nine permission roles that you can assign them. Following are those various 9 user permissions that you can assign the users in regard to the database:

Permission

Allows a user to

Open/Run Open a database, form, or report. Run a macro.
Open Exclusive Open a database on a network while ensuring that others cannot open the database while the first user has it open.
Read Design View the design of objects. No changes to the design are allowed.
Modify Design Change the design of objects and delete objects.
Administer Set database passwords, replicate databases, and change startup properties. Have full access to objects and data, and assign permissions for objects.
Read View data, but not table designs or query designs.
Update View and edit data, but not insert or delete data.
Insert View and insert data, but not change or delete data.
Delete View and delete data, but not change or insert data.

These highly specific user permissions have been created for the admin to establish a proper hierarchy in the database management system between the users. However, not always do these user permissions manage to deal with the data security and data breaching issues within the organization which is why there’s a need for a way by which you can permanently kick a user out of MS Access. Let’s finally discuss that.

The Solution

Unfortunately, there is no direct in-built option in an MS Access file to kick a user out of the database completely. However, something else that you can do instead of kicking the user out of MS Access is, create a DetectIdleTime form. Also, make sure that this form is open and hidden during the startup. The code of the form would be something like this:

How to kick users out of MS Access?

Option Compare Database

Option Explicit

Private Sub Form_Timer()

         Const IDLEMINUTES = 60

         Static PrevControlName As String

         Static PrevFormName As String

         Static ExpiredTime

         Dim ActiveFormName As String

         Dim ActiveControlName As String

         Dim ExpiredMinutes

         On Error Resume Next

         ActiveFormName = Screen.ActiveForm.Name

         If Err Then

            ActiveFormName = “No Active Form”

            Err = 0

         End If

         ActiveControlName = Screen.ActiveControl.Name

            If Err Then

            ActiveControlName = “No Active Control”

            Err = 0

         End If

         If (PrevControlName = “”) Or (PrevFormName = “”) _

           Or (ActiveFormName <> PrevFormName) _

           Or (ActiveControlName <> PrevControlName) Then

            PrevControlName = ActiveControlName

            PrevFormName = ActiveFormName

            ExpiredTime = 0

         Else

            ExpiredTime = ExpiredTime + Me.TimerInterval

         End If

         ExpiredMinutes = (ExpiredTime / 1000) / 60

         If ExpiredMinutes >= IDLEMINUTES Then

            ExpiredTime = 0

            IdleTimeDetected ExpiredMinutes

         End If

End Sub

Sub IdleTimeDetected(ExpiredMinutes)

   With Screen.ActiveForm

      If Screen.ActiveForm.Dirty = True Then

      .Undo

      End If

      End With

   Application.Quit

End Sub

Related articles
Join the discussion!