Change password form without user account info showing

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using MS Access 2002 with a secure workgroup using the built in account and permissions routine. The application has a fairly polished front end application, but for the way passwords are changed.

Currently I have a swithcboard button that opens the MS Access user account form (Running macro - DoCmd.RunCommand acCmdUserAndGroupAccounts) where a user can change his/her password on the applicable tab. While the common users cannot change account info I'd really like for them just to get the change password tab without having to click on the tab and without seeing any other security account information or settings.

I don't mind making special forms, macros or such to do this, but I can't seem to figure out how to do this without re-inventing my own security schema, which I have no interest in doing.

Thanks,
 
You can create your own form with 2 unbound text boxes -- one for user name
and one for password (set it's format mask to password). Add a button with a
call to the following function from the Security FAQ.

Function faqChangePassword (ByVal strUser As String, _
ByVal strPwd As String) As Integer

Dim ws As Workspace
Dim usr As User

Set ws = DBEngine.Workspaces(0)
Set usr = ws.Users(strUser)
usr.NewPassword "", strPwd
End Function

The function call can look something like this:

Private Sub cmdChangePassword_Click()
Dim v_PW_Return As Integer
v_PW_Return = faqChangePassword(Me.txtUserName, Me.txtPassword)
End Sub

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


LDV said:
I'm using MS Access 2002 with a secure workgroup using the built in
account and permissions routine. The application has a fairly polished
front end application, but for the way passwords are changed.
Currently I have a swithcboard button that opens the MS Access user
account form (Running macro - DoCmd.RunCommand acCmdUserAndGroupAccounts)
where a user can change his/her password on the applicable tab. While the
common users cannot change account info I'd really like for them just to get
the change password tab without having to click on the tab and without
seeing any other security account information or settings.
I don't mind making special forms, macros or such to do this, but I can't
seem to figure out how to do this without re-inventing my own security
schema, which I have no interest in doing.
 
LDV,
I forgot to mention that to use the function below the user must be a member
of the Admins group. If they are not you will need to use the following
function and add the OldPassword parameter to the call.

Function faqChangePassword(ByVal strUser As String, _
ByVal strPwd As String, ByVal strOldPwd As String) As Integer

Dim ws As Workspace
Dim usr As User
On Error GoTo err_ChangePassword

Set ws = DBEngine.Workspaces(0)
Set usr = ws.Users(strUser)
usr.NewPassword strOldPwd, strPwd
err_ChangePassword:
If Err.Number = 3033 Then
MsgBox "You do not have permission to modify passwords. Please contact
your system administrator."
End If

End Function
 
Back
Top