Create a Microsoft Access Login Form and User Permissions with VBA
Question details
Create a login form that gives most users a read-only interface and administrators an editable interface.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A database is shared by multiple users who need different levels of access.
- Observed behavior
- Readers should be able to view data, while administrators should be able to make changes.
Identify which forms and operations readers and administrators need to use. Decide how users will be authenticated and where the role information will be maintained; do not store plain-text passwords in an Access table.
Build a role-based login form in Microsoft Access
Use a login form and role-based form settings to provide different interfaces for readers and administrators.
VBA form settings control the interface, not the underlying data. Users who can access the database or its tables directly may be able to bypass these restrictions.
For security that must be enforced, use a server-based back end with authentication and permissions appropriate to each user or role.
In Access, use Create > Table Design to create a user table with a unique user name and a role field, such as Reader or Administrator. Manage authentication securely rather than storing plain-text passwords.
Use Create > Form Design to add user name and password controls and a Sign In button. Add VBA to the button's On Click event to validate credentials through your chosen secure authentication method.
After successful authentication, retrieve the user's role and open the appropriate form. In each data-entry form's On Load event, use VBA to set Allow Edits, Allow Additions, and Allow Deletions to No for readers and Yes for administrators where appropriate.
Open File > Options > Current Database and select the login form under Display Form. Review navigation and startup options to reduce accidental access to other forms, but do not rely on these settings as a security boundary.
Open the database and sign in with test Reader and Administrator accounts. Check that readers cannot edit through the forms and that administrators can perform their intended tasks.

Secure the Access database and its data source
Use file and data-source permissions to protect data beyond the VBA interface.
Use WPS Office for Everyday Office Files
WPS Office is a free, lightweight alternative for everyday documents, spreadsheets, and presentations. Its familiar interface and Microsoft Office format compatibility help with migration, but it does not replace Microsoft Access or enforce Access database permissions.

Frequently Asked Questions
Does a VBA login form secure an Access database?
No. A login form can control which forms and editing controls users see, but it does not prevent direct access to tables. Use data-source authentication and permissions when access restrictions must be enforced.
How do I make an Access form read-only for readers?
In the form's Property Sheet or On Load VBA event, set Allow Edits, Allow Additions, and Allow Deletions to No for the Reader role. These settings restrict the form, not direct access to its underlying tables.
Can I use Access user-level security with an ACCDB file?
No. Legacy Access user-level security applies to older MDB databases, not ACCDB files. For stronger permissions with ACCDB front ends, consider a server-based back end that enforces user or role permissions.
Should I store login passwords in an Access table?
Do not store passwords in plain text. Use a securely managed authentication method, such as authentication provided by an appropriately configured server, rather than relying on credentials stored in the Access file.




