VBA code for forgot password and change password in acce07 (1 Viewer)

sachuchem22

New member
Local time
Today, 15:54
Joined
May 11, 2016
Messages
6
I have an login form with different permission for different user and work perfectly but I want add forgotten password button to login form and on click it open form which having 2 security questions after correct answer want to reset password and also want add change password button to main form by reset password by using current password. I can't know how to do it. Please help me.
 

Cronk

Registered User.
Local time
Tomorrow, 08:54
Joined
Jul 4, 2013
Messages
2,771
What have you done so far? Added the fields to hold the questions/answers, created the form, added the button, written any code?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 17:54
Joined
Feb 28, 2001
Messages
27,129
You can create a form in pop-up mode and have a password text box on it. In the properties of the text box, there is an input mask that can be set to Password. If you do this, then type your characters but they will echo as "*" no matter what you type.

As to how you trigger these things, put a couple of controls on the form from which you want to launch these features. You can even just make two labels that contain the words "Forgot Password" and "Change Password" and then just have an OnClick routine for each label that will launch the appropriate pop-up form. You probably want two different forms... one for the "Forgot Password" that prompts you for the security questions and one for the "Change Password" that prompts for the old password and then prompts for the new one.

I hesitate to actually try to write this out for you since this sort of thing is a matter of style and preferences. However, you can find hints using the Search function on this forum or you can use any decent web browser.

You will need to search for "Pop-Up Forms" and "Text Box .InputMask" - and you can trust me about having an OnClick for a label or you can look up "Label Properties" too.

Pardon me for stating the obvious, but if you are going to have security questions you will want places (in a table) to store those questions and the correct answers. You might also wish to use the .InputMask property to hide the security question answers when being entered for the "Forgot Password" case. You will certainly want that for the old and new password entry portions for the "Change Password" case.
 

sachuchem22

New member
Local time
Today, 15:54
Joined
May 11, 2016
Messages
6
THANKS and sorry cronk and The Doc Man. I want to written any code but I don't know how ? Please suggest any code
 

isladogs

MVP / VIP
Local time
Today, 23:54
Joined
Jan 14, 2017
Messages
18,209
Just to add to Doc's comment, I would also strongly recommend storing the passwords in an encrypted format for additional security.
 

GinaWhipp

AWF VIP
Local time
Today, 18:54
Joined
Jun 21, 2011
Messages
5,900
This should get you started...


Code:
    If Me.cboAssociateID = "" Or IsNull(Me.cboAssociateID) Then
        MsgBox "Please select your User Name first!", vbInformation + vbOKOnly, "User Name"
        Exit Sub
    Else
        If Me.cboAssociateID.Column(2) = "" Then
            MsgBox "No eMail Address on file, see the Database ADMIN to get your password!", vbCritical + vbOKOnly, "No eMail on file"
            DoCmd.CancelEvent
        Else
            If DLookup("aqAnswer", "tblAssociatesQuestion", "aqAssociateID =" & Me.cboAssociateID) <> "" Then
                DoCmd.OpenForm "frmPasswordRecovery", , , , , acDialog
            Else
                SendPasswordeMailToAssociate (Me.cboAssociateID)
                MsgBox "Your Password has been eMailed to you.", vbInformation + vbOKOnly, "Forgot Password"
            End If
        End If
    End If

However, you are going to need some validation to confirm the person requesting the password reset is the person the log on belongs to, i.e. matching their logon to their name in a table that stores their machine name.

And... SendPasswordeMailToAssociate is actually a Function but you can use your own for that. You will also need a frmPasswordRecovery where they will answer preselected questions they should have set up when they initially created their password.
 

Users who are viewing this thread

Top Bottom