"MLH" <CR**@NorthState.net> wrote in message
news:vh********************************@4ax.com...
What's the simplest way to allow a user
of an A97 app to change password?
Their own Access user-level security password? Simplest for you or the
user? The simplest for you might be to let them use the built-in tools (the
workgroup administrator) and show them the change logon password tab.
However it wouldn't be too much work to create a popup form specifically to
change their own passwords - have 3 textboxes txtOldPassword,
txtNewPassword, txtConfirmPassword with a buttons OK and Cancel. The OK
button calls a function like below:
Private Function ChangePassword(strOld As String, _
strNew As String, _
strVerify As String) As Boolean
On Error GoTo Err_Handler
Dim wks As DAO.Workspace
If strNew <> strVerify Then
MsgBox "Your new password and the verification of your " & _
"new password do not match." & vbCrLf & _
"Please try again.", vbExclamation, "Cannot change password"
Exit Function
End If
If strNew = strOld Then
MsgBox "Your new password is the same as your old password" & vbCrLf
& _
"Please try again.", vbExclamation, "Cannot change password"
Exit Function
End If
Set wks = DBEngine(0)
wks.Users(CurrentUser).NewPassword strOld, strNew
ChangePassword = True
Exit_Handler:
If Not wks Is Nothing Then Set wks = Nothing
Exit Function
Err_Handler:
Select Case Err.Number
Case 3033
MsgBox "Old password is not correct" & vbCrLf & _
"Please try again." & vbCrLf & vbCrLf & _
"(remember passwords are case sensitive)", vbExclamation,
"Cannot change password"
Case Else
MsgBox Err.Description, vbExclamation, "Error No: " & Err.Number
End Select
Resume Exit_Handler
End Function