![microsoft access multiple user microsoft access multiple user](https://images.template.net/wp-content/uploads/2015/06/Free-MS-Access-Scheduling-Template-2013.jpg)
In the On Open event of the form you place code like: MsgBox “You are not authorized to open this form!”, vbOkOnly + vbExclamationĬase 2: Making a form read-only for Readers If Forms!frmLogin!cboUser.Column(4) 2 Then In the On Open event of the form, you place code like: Following are some examples of this:Ĭase 1: Restricting access to a form only to administrators Once you have retrieved the Access level, you can use it to restrict access to forms and controls based on the access level assigned to the user. You can reference the column in the combobox by using the expression:ĭlookup(“”,”tblUser:,” = “ & Forms!frmLogin!cboUser) This is done by checking the Access level in one of two ways. The final piece to this is using the AccessLevel to restrict access to various parts of the application.
MICROSOFT ACCESS MULTIPLE USER PASSWORD
The user then enters the new password twice to confirm it. So when it’s opened, it’s filtered for the selected user. The Password Reset form (frmPasswordChange) is bound to tblUser. MsgBox “Password does not match, please re-enter!”, vboOkOnly + vbExclamation If Me.txtPassword = Me.cboUser.Column(2) ThenĭoCmd.OpenForm “frmPasswordChange”,, , “ = ” & Me.cboUser MsgBox “You need to select a user!”, vbCritical
![microsoft access multiple user microsoft access multiple user](https://dispatch.m.io/wp-content/uploads/2019/04/Switching-between-tenants-LinkedIn.png)
Alternatively you can save the value in a global variable and close the form. This is so the cboUser control can be referenced in other parts of the application. If Reset is false, then the main menu is opened. If there is a match, then the Reset column in the RowSource is checked to see if the user is required to set a new password If it is, a form is opened to enter a new password. If it doesn’t, focus is returned to the txtPassword control. The next step is to check if the password entered matches the stored password. If, not focus is returned to the cboUser combo. The first task the code performs is to make sure a user has been selected. This code will be entered in the AfterUpdate event of the password textbox. Now we get into the VBA that drives the security. The user will select their name from the combobox and then the password in the textbox. SELECT tblUser.UserID, & “, ” & AS Fullname, tblUser.Password, tblUser.PWReset, tblUser.AccessLevelID I suggest the name frmLogin for the form, cboUser for the combobox and txtPassword for the textbox.įor the combobox, you will set the ColumnCount to 5, the ColumnWidths to 0 1 0 0 0 and the RowSource property to the following SQL statement or create a named query: Also set the Navigation Bar and Record Selector properties to No. You will want to restrict this form by turning off the Min, Max and Close buttons. This will be an unbound form with two controls a combobox to select the user and a textbox to enter the password. Once you have the tables setup, you can create the Login form. You can also add more fields to tblUser if needed. The above is provided as a basic example. You can use whatever and how many levels you want or need depending on your application. For this example we will have four Access levels: AccessLevelID The second table is a lookup for the AccessLevelID in tblUser. The first step is to setup the tables needed to drive the security. I’ll be using a fairly simple example for this article, but it should give you enough to expand on for more complex needs. But if you don’t need high level security, you can secure your database using VBA. If you really need strong security on a database, you are better off using a more secure back end like SQL Server. First, let me state that Access is not the most secure platform.