1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Create a "Change Password" form for Login in Access 2007

Discussion in 'Business Applications' started by krs1716, Apr 27, 2012.

Thread Status:
Not open for further replies.
Advertisement
  1. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    Change the user name Combo to a "Find" combo, this will find the record for that person in the form.
     
  2. krs1716

    krs1716 Thread Starter

    Joined:
    Feb 10, 2012
    Messages:
    438
    Okay. I created a Find Combo, but how do I get it to automatically pull the record for the person who is signed in?
     
  3. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    A find combo should do that automatically.
    Are you sure it is a "find" combo.
     
  4. krs1716

    krs1716 Thread Starter

    Joined:
    Feb 10, 2012
    Messages:
    438
    I chose the "Find a record on my form based on the value I selected in my combo box." option. Is that what I wanted to do?
     
  5. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    Yes, when you select the user for the password entry the form should move to the correct record, have you made the fields visible to see what is happening?
     
  6. krs1716

    krs1716 Thread Starter

    Joined:
    Feb 10, 2012
    Messages:
    438
    Yes, I have all fields visible. I think I misrepresented my problem. I can choose anyone I want from the drop down menu, and the database knows to bring up that person's information. However, I wanted the form to recognize who was logged in, and automatically bring up that person's name and ID number. Then, I could disable the field, so that people can only have access to their own information.

    Does that make sense? Can I do that?
     
  7. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    Sorry, I thought you were talking about the original Log in form, but now I assume that you are talking about the Change password form?
    You can use VBA to filter the form when it is opened using the public variable.
     
  8. krs1716

    krs1716 Thread Starter

    Joined:
    Feb 10, 2012
    Messages:
    438
    Okay...sorry for the miscommunication.

    Yay! VBA!!! Is it possible/probable for me to do it or find it?
     
  9. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    Look at the form opening button's VBA it uses the variable
    Dim stLinkCriteria As String
    add a line of code
    stLinkCriteria = lngMyEmpID
     
  10. krs1716

    krs1716 Thread Starter

    Joined:
    Feb 10, 2012
    Messages:
    438
    That didn't work. Could I be missing something?
     
  11. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    No you are not missing anything, it is an Access 2007 bug.
    The alternative is to add this to the Password Form's On Load Event Procedure.

    Me.Filter = "[lngEmpID] = " & lngMyEmpID
     
  12. krs1716

    krs1716 Thread Starter

    Joined:
    Feb 10, 2012
    Messages:
    438
    That still doesn't make the employee's name appear automatically. Do I need to link the forms together or something like that? I think I read an article on that a couple of weeks ago.
     
  13. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    It works for me. Do you want me to send you your database with the change in it?
     
  14. krs1716

    krs1716 Thread Starter

    Joined:
    Feb 10, 2012
    Messages:
    438
    That would be great. Thanks.
     
  15. krs1716

    krs1716 Thread Starter

    Joined:
    Feb 10, 2012
    Messages:
    438
    Yay! That worked. Just a note...the issue with my Change Password form vs. yours is that you had the field from the table representing the employee (i.e. strEmpName). I had an unbound combo box.

    So sorry for the issues. I guess I had to see it to understand it.

    Now, one more thing on this subject :)...I have some VBA code written that I think will check the value of the Old password to see if it is correct. However, I have no idea how to write the code to check the "New Password" field against the "Confirm New Password" field and then use that confirmation to change the password in the employees table (tblEmployees).

    The code I have to check the value in the Old Password field is as follows (after clicking a button called "OK":
    Option Compare Database
    Private Sub Command1_Click()
    'Check to see if data is entered into the password box
    If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
    MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
    Me.txtPassword.SetFocus
    Exit Sub
    End If
    'Check value of password in tblEmployees to see if this
    'matches value chosen in combo box
    If Me.txtPassword.Value = DLookup("strEmpPassword", "tblEmployees", _
    "[lngEmpID]=" & Me.cboEmployee.Value) Then
    lngMyEmpID = Me.cboEmployee.Value
    'Close Change Password Form
    'Close Change Password form
    DoCmd.Close acForm, "Change Password Form", acSaveYes
    End If
    Else
    MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
    "Invalid Entry!"
    Me.txtPassword.SetFocus
    End If
    End Sub
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1051023