Change User's Password with ADOX

T

Tony_VBACoder

In my Secured Access 2002 application, I want to be able
to allow the CurrentUser the ability to change their
password with a custom form. My form has 3 text boxes:
1)Current Password (txtCurrentPassword)
2)New Password (txtNewPassword)
3)Verify Password (txtVerifyPassword)

I want to make sure the user enters their correct password
in the "txtCurrentPassword" field before they can change
their password. I also want to be able to make sure that
the "txtNewPassword" equals the "txtVerifyPassword"
textboxes. I have all the code in place to do the compare
between the "New" and "Verify" textboxes, but I do not
know how to check if they entered their current password.
How do I use ADOX to read in the CurrentUser() password?

My code to change the password is below, but how do I read
in their password so I can verify that they correctly
entered it in the txtCurrentPassword field?

Public Sub ChangeUserPassword(sUserName As String,
sPasswordOld As String, sPasswordNew As String)
Dim cat As ADOX.Catalog
Dim usr As ADOX.User

On Error GoTo Oops

Set cat = New ADOX.Catalog
cat.ActiveConnection = CurrentProject.Connection

Set usr = cat.Users(sUserName)
usr.ChangePassword sPasswordOld, sPasswordNew

MsgBox "Password Changed"

Exit Sub

Oops:
MsgBox Err.Number & ": " & Err.Description

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top