Results 1 to 6 of 6
  1. #1
    Mainer is offline Novice
    Windows 10 Office 365
    Join Date
    Feb 2022
    Posts
    2

    VBA code for form for password change

    I am an "advanced" Access user but just beginning to tackle actual VBA coding.
    I have a users table with userID and Username and Password for those using a front end database
    I have just made a form with a typical password change setup

    UserID


    Username
    Old password
    New password

    I have a button on the login form that users see when successfully logged in

    What code can I use so that the loggedin user can change the password ?

    Thanks for any help

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Here's one way:

    Code:
      CurrentDb.Execute "UPDATE tblUsers SET UserPassword = '" & Me.txtCnfPW & "' " & _
                         "WHERE UserName='" & Me.txtUserID & "'"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    also take a look at the bottom of this thread where the same question has been asked - I see 5 threads on the subject

  4. #4
    Mainer is offline Novice
    Windows 10 Office 365
    Join Date
    Feb 2022
    Posts
    2
    Thanks- I will check this out. Meantime can you explain Me.txtCnfPW ?
    Fred

  5. #5
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,821
    Hi Fred

    Me.txtCnfPW is the reference to the Unbound Control named "txtCnfPW" on the Login Form

    You would have to change this name to match the name you have given to your New Password Control.



  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    And the same with txtUserID.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Password Change Form
    By Delfina in forum Programming
    Replies: 11
    Last Post: 02-16-2019, 12:50 PM
  2. Replies: 4
    Last Post: 03-28-2017, 03:10 PM
  3. Replies: 4
    Last Post: 12-16-2015, 02:41 PM
  4. Replies: 1
    Last Post: 06-22-2012, 08:05 AM
  5. Help fixing a code to change password programatically
    By smartflashes in forum Programming
    Replies: 3
    Last Post: 01-19-2012, 10:20 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums