Skip to content
Microsoft Access Programs
  • Home
  • About
  • Tutorial
    • MS-Access
    • MS-Excel
  • My Account
  • Shop
  • 0
  • Toggle website search
0 Menu Close
  • Home
  • About
  • Tutorial
    • MS-Access
    • MS-Excel
  • My Account
  • Shop
  • 0
  • Toggle website search

Microsoft Access Sign in Form

MS Access Login Form
Microsoft Access Sign-In Form is one of the most needed by MS access programmers. Using sign in form will definitely secure your database. However, before creating a log-in form, you have to create a user table with identified user ID and username. The steps to create the login form are:
  1. Create a table and give it a name.
  2. Add three fields: User ID, Username, and Password. The username has to be unique.
  3. Set the input mask of the User Password to “Password”.
  4. Create a Modal Dialog and then insert two unbounded fields. One for the username and the other for the password.
  5. Insert two commands: OK and Exit buttons.
  6. Right click on each button and paste the below VBA Codes to each one based on their event procedures.
Download

MS Access login form with password download

Exit Button VBA Code:

				
					If MsgBox("Quit Program?", vbYesNo, "Quit") = vbYes Then DoCmd.Quit
				
			

OK Button VBA Code For Microsoft Access Sign in Form:

				
					Dim rs As Recordset
Dim Security, User As String

On Error GoTo Err:

Set rs = CurrentDb.OpenRecordset("tblUser", dbOpenSnapshot, dbReadOnly)
rs.FindFirst "UserName='" & Me.User & "'"

' Check Username & Password

If rs.NoMatch = True Then
    Me.User.SetFocus
    MsgBox "Wrong User Name", vbCritical, "Login"
Exit Sub
End If

If IsNull(Me.txtPassword) Then
    Me.txtPassword.SetFocus
    MsgBox "Insert Password.", vbCritical, "Login"
Exit Sub
End If

If rs!UserSecurity <> Me.txtPassword Then
    MsgBox "Wrong Password, Please try again.", vbCritical, "Login"
Else

DoCmd.OpenForm "frmMain", acNormal, , "UserName='" & Me.User & "'"
DoCmd.Close acForm, "frmLogin", acSaveNo
DoCmd.Close acForm, "frmBackGround", acSaveNo

End If

Exit Sub

Err:
MsgBox Err.Description, vbCritical
				
			
The downloadable file will provide you with all the VBA codes for Microsoft Access Sign-In Form:
  1. Create Microsoft Access Login Form.
  2. Add, Remove, Edit users.
  3. Control Amin and users passwords.
  4. Authority to grant access command buttons.
  5. Auto Log out when idle for a specific time.

In addition to Microsoft Access Login Form, the downloadable file will also include the Idle timeout feature. You can refer to our post for MS Access Idle Timeout here.

Download

* Login password: 123

To use Microsoft Access Programs,
you’ll need to have Microsoft Office installed including the bundle of MS Access or to download the free Microsoft Access 2016 run-time.

 

Please check our Pro Microsoft Access Programs here.

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on Pinterest (Opens in new window) Pinterest
  • More
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Telegram (Opens in new window) Telegram
PrevPreviousMS Access: Search As You Type – Multi Fields
NextMS Access Numbers to WordsNext
  • About
  • Contact
  • Terms and Conditions
Copyright © 2021 Microsoft Access Programs
×
×

Cart