Skip to content
No results
  • Home
  • Projects
  • Series
    • Accounting Series
  • Downloads
  • Tutorials
    • MS Access Tutorials
  • Blog
    • MS Access Blog
  • Forum

Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

skillheader Logo
  • Home
  • Projects
  • Series
    • Accounting Series
  • Downloads
  • Tutorials
    • MS Access Tutorials
  • Blog
    • MS Access Blog
  • Forum
skillheader Logo

Part 4 – Forgot Password System in MS Access

  • May 18, 2024
  • Projects

A strong password system is crucial to keep any system secure. But what if we forget our passwords? This is where “Forgot Password System” comes in handy. They are a lifesaver for those who are forgetful or concerned about security, especially when dealing with platforms such as Microsoft Access.

In this section, you will learn, how to make a functional User Registration form and Forgot Password system in the Access Database Step by Step.

Watch the Video

Subscription to Download Project

Overview of Forgot Password System

Imagine a scenario where a user has been assigned tasks related to sales and stock maintenance in a business database. However, due to a sudden mental blank or a change in personnel, the user is unable to remember the password and is stuck at the login screen. But, there is no need to worry as the Forgot Password System is here to come to the rescue.

Let’s have a look, at how it will work.

User Verification

Before proceeding to the Forgot Password System, the user account must be verified whether it exists or not. There can be several methods to verify a user account, these methods refer to some other security measures other than the password.

Account Recovery Methods

To recover an account, there can be several methods to reset the password for a local database, these are some of the common options:

  • A PIN can be assigned to the user
  • Recovery phone number or a passcode
  • Security Questions
  • Recovery phrase

You can use any of these options but we are going to use the last 5 digits of the phone number as a recovery method in this project.

There are more advanced account recovery methods like:
SMS or OTP code verification
Email code verification
Security key, usually stored in a USB drive

Password Policy

The process of password policy will remain the same as described in “Part-3 Change Password System“.

New User Register Process

Add New User Form

Create a New User Register form based on the User table described in Part 2 of the Ultimate Login System

All text boxes and a combo box of the form will be unbound.

Add a field in the User Table for the last 5 digits of the user’s phone number to verify the user before proceeding to change the password. The data type of the field should be “Short Text”.

Register Button Functions

Mandatory Fields: Before inserting the user input data into the table, mandatory fields must be filled as mentioned with the asterisk sign.

Phone Criteria: An error message will appear if the phone’s digits length is more than 5.

Password Match: If the “password” and “verify password” do not match, the error message will appear.

Enter Data: Proceed to enter data into the table if no error is found.

Register Button Code

Private Sub Command17_Click()
If IsNull(Me.r_name) = True Or IsNull(Me.r_phone) = True Or IsNull(Me.r_username) = True Or IsNull(Me.r_password) = True Or IsNull(Me.r_vpassword) = True Then
    MsgBox ("Mandatory fields must be filled !"), , "| Dara Required |"
    Exit Sub
        Else
            If Len(Me.r_phone) > 5 Then
                MsgBox "The phone digits must be at least 5 numbers", , "| Phone Digits limits exceed |"
                Exit Sub
                    Else
                        If Me.r_password <> Me.r_vpassword Then
                            MsgBox "Password do not match...", , "| Password must be matched |"
                            Exit Sub
                                Else
                                    Set rst = CurrentDb.OpenRecordset("UserTable", dbOpenDynaset, dbSeeChanges)
                                    With rst
                                    .AddNew
                                    .Fields("uname") = Me.r_name
                                    .Fields("uphone") = Me.r_phone
                                    .Fields("udate") = Date
                                    .Fields("ugender") = Me.r_gender
                                    .Fields("uage") = Me.r_age
                                    .Fields("uusername") = Me.r_username
                                    .Fields("upassword") = Me.r_password
                                    .Fields("ustatus") = "User"
                                    .Update
                                    End With
                                    Set rst = Nothing
                                    DoCmd.Close acForm, "RegisterUser", acSavePrompt
                                    
                            End If
                    End If
    End If
End Sub

Steps of Forgot Password System in MS Access

As you know the purpose of the user’s 5-digit last phone number is to validate the user to change his password so, the “New Password” and “Verify Password” text boxes should appear only after clicking the “Check Validity” button.

Forgot Password Form and Process

Apply the Password mask to both Password text boxes.

Hide both the “New Password” and “Verify Password” text boxes by default.

Check the user input of “Authentication 5 digit” from the user table based on the criteria of the Username.

If both the Username and the 5-digit code match, both password-related text boxes will be unhide.

Check Validity Button Functions

Here is the “Check Validity” button code:

Private Sub Command7_Click()
If IsNull(Me.f_username) = True Or IsNull(Me.f_phone) = True Then
    MsgBox "Please fill both Username and Authentication code.", , "| Empty data |"
    Exit Sub
        Else
            If DCount("*", "UserTable", "uphone = '" & Me.f_phone & "' and uusername = '" & Me.f_username & "'") = 1 Then
                
                Me.f_password.Visible = True
                Me.f_vpassword.Visible = True
                Me.f_password.SetFocus
            
                Me.f_username.Enabled = False
                Me.f_phone.Enabled = False
                Exit Sub
                    Else
                        MsgBox "Something wrong with the data entered.", , "| Error |"
                        Exit Sub
        End If
End If
End Sub

Submit Button Functions

Mandatory Fields: Before proceeding to edit the user input data into the table, mandatory fields must be filled (All fields are mandatory in this case).

Password Match Criteria: An error message will appear if both passwords do not match.

Update Table: Proceed to update data in the table if no error is found.

Private Sub Command8_Click()
If IsNull(Me.f_password) = True Or IsNull(Me.f_vpassword) = True Then
    MsgBox "Please fill both Username and Authentication code.", , "| Empty data |"
    Exit Sub
        Else
            If Me.f_password <> Me.f_vpassword Then
            MsgBox "Password not matched"
            Exit Sub
                Else
                'Find record ID to update the record of in the table
                fid = DLookup("uid", "UserTable", "uphone = '" & Me.f_phone & "' and uusername = '" & Me.f_username & "'")
                'ID has been stored in fid
                
                Dim recf As Recordset
                Set recf = CurrentDb.OpenRecordset("UserTable", dbOpenDynaset, dbSeeChanges)
                With recf
                    .FindFirst "uid = " & fid
                    .Edit
                    .Fields("upassword") = Me.f_password
                    .Update
                End With
                Set recf = Nothing
                DoCmd.Close acForm, "ForgotPassword", acSavePrompt
            End If
End If
End Sub

<<Part 3 – Change Password System in MS Access

Part 5 – Secure Your Login System in MS Access>>

Live Search

No results
  • Watch complete Project/Tutorial Videos
  • Source Code
  • Open Source Project Files
  • Free help on Your Projects
Select Project/Tutorial to Subscribe

Blog Posts

Placeholder on Text box or Combo box in MS Access Forms

August 16, 2024

Uncover Password Mask Unmask VBA Strategies in MS Access

June 1, 2024

How to Filter Data Between Two Dates in MS Access

May 21, 2024

How to Search Records using Number Values with Factors in MS Access

May 21, 2024

How to Find Record using Combo Box List Selection or Type

May 21, 2024

The future belongs to those who learn more skills and combine them in creative ways.

Robert Greene

Related Posts

Employee Management HR System featured

Ultimate All-in-One Employee Management & HR System

  • July 4, 2025
Master Accounting Featured Image

How to Build Accounting Software in MS Access – Free Guide

  • November 9, 2024
  • 5 Comments
MCQ Exam Featured

Smart Automated MCQ Exam System | Revolutionizing IQ Learning

  • November 3, 2024

About | Contact Us | Support Us

Copyright © 2025 - skillheader

Privacy Policy | Terms of Use | Forum Rules