Change Password by User

S

satdist

I have a multi user database that is secure and split. I am looking for
the details of how to add a user password change form. I have tried
numerous times using what I could find in this group as far as
instructions and no luck, there has to be some detail I'm missing. The
following are the last instructions I've tried:

Create a form with the following textboxes:

Current User: set the Control Source =CurrentUser()
OldPW (old password)
NewPW (new password)
ConfirmPW (confirm password)


Add a command button, call it cmdSetPassword and drop in the following
procedure in the Click event


Private Sub cmdSetPassword_Click()
'Change the user's password. Confirm that the passwords typed are the
same.
Dim curr_user As User


On Error Goto FailedPW


If Me.NewPW <> Me.ConfirmPW Then
MsgBox "New passwords are not identical. Please retype
passwords and
try again.", _
vbOKOnly, "Change Password Failed"
Exit Sub
End If


If Len(Me.NewPW) < 4 Or Len(Me.NewPW) > 14 Or IsNull(Me.NewPW) Then

MsgBox "New passwords must be between 4 and 14 characters.",
vbOKOnly, "Change Password Failed"
Exit Sub
End If


Set curr_user = DBEngine.Workspaces(0).Users(CurrentUser())


If IsNull(Me.OldPW) Then
curr_user.NewPassword "", Me.NewPW
Else
curr_user.NewPassword Me.OldPW, Me.NewPW
End If


MsgBox "Your new password has been set and will take effect the
next
time you log on.", _
vbOKOnly, "Password confirmed"
DoCmd.RunCommand acCmdClose


Exit Sub


FailedPW:
If Err.Number = 3033 Then
MsgBox "Old password is incorrect. Please retype and try
again.",
vbOKOnly, "Change Password Failed"
Me.OldPW.SetFocus
Else
MsgBox "Error number " & Err.Number & ": " & Err.Description
End If


End Sub

Thanks for any help you can give.
 
6

'69 Camaro

Hi.
I have tried
numerous times using what I could find in this group as far as
instructions and no luck, there has to be some detail I'm missing.

Since you don't describe what error message or failures you're getting, "no
luck" doesn't really tell us what your problem might be. However, the easiest
way to allow the user to change his own password is by putting a button on a
form, place [Event Procedure] in the button's OnClick( ) event, and paste this
code in the form's module, ensuring the name of the button matches what is
ChgUsersPswdBtn in this example, then save and compile the code.

Private Sub ChgUsersPswdBtn_Click()

On Error GoTo ErrHandler

SendKeys "^+{TAB}", False
RunCommand acCmdUserAndGroupAccounts

Exit Sub

ErrHandler:

MsgBox "Error in ChgUsersPswdBtn_Click( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear

End Sub ' ChgUsersPswdBtn_Click( )

Open the form in Form View and select the button to open the Change Logon
Password dialog window.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.
 
S

satdist

Thank you very much 69 Camoaro for the help....worked just as needed. I
have another issue I need clarification on. There are two people with
Admin privledges and 28 users with limited privledges, is there a code
I can use at log on that will open a certain form by user or group?
Thanks again you made my day.


'69 Camaro said:
Hi.
I have tried
numerous times using what I could find in this group as far as
instructions and no luck, there has to be some detail I'm missing.

Since you don't describe what error message or failures you're getting, "no
luck" doesn't really tell us what your problem might be. However, the easiest
way to allow the user to change his own password is by putting a button on a
form, place [Event Procedure] in the button's OnClick( ) event, and paste this
code in the form's module, ensuring the name of the button matches what is
ChgUsersPswdBtn in this example, then save and compile the code.

Private Sub ChgUsersPswdBtn_Click()

On Error GoTo ErrHandler

SendKeys "^+{TAB}", False
RunCommand acCmdUserAndGroupAccounts

Exit Sub

ErrHandler:

MsgBox "Error in ChgUsersPswdBtn_Click( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear

End Sub ' ChgUsersPswdBtn_Click( )

Open the form in Form View and select the button to open the Change Logon
Password dialog window.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.


I have a multi user database that is secure and split. I am looking for
the details of how to add a user password change form. I have tried
numerous times using what I could find in this group as far as
instructions and no luck, there has to be some detail I'm missing. The
following are the last instructions I've tried:

Create a form with the following textboxes:

Current User: set the Control Source =CurrentUser()
OldPW (old password)
NewPW (new password)
ConfirmPW (confirm password)


Add a command button, call it cmdSetPassword and drop in the following
procedure in the Click event


Private Sub cmdSetPassword_Click()
'Change the user's password. Confirm that the passwords typed are the
same.
Dim curr_user As User


On Error Goto FailedPW


If Me.NewPW <> Me.ConfirmPW Then
MsgBox "New passwords are not identical. Please retype
passwords and
try again.", _
vbOKOnly, "Change Password Failed"
Exit Sub
End If


If Len(Me.NewPW) < 4 Or Len(Me.NewPW) > 14 Or IsNull(Me.NewPW) Then

MsgBox "New passwords must be between 4 and 14 characters.",
vbOKOnly, "Change Password Failed"
Exit Sub
End If


Set curr_user = DBEngine.Workspaces(0).Users(CurrentUser())


If IsNull(Me.OldPW) Then
curr_user.NewPassword "", Me.NewPW
Else
curr_user.NewPassword Me.OldPW, Me.NewPW
End If


MsgBox "Your new password has been set and will take effect the
next
time you log on.", _
vbOKOnly, "Password confirmed"
DoCmd.RunCommand acCmdClose


Exit Sub


FailedPW:
If Err.Number = 3033 Then
MsgBox "Old password is incorrect. Please retype and try
again.",
vbOKOnly, "Change Password Failed"
Me.OldPW.SetFocus
Else
MsgBox "Error number " & Err.Number & ": " & Err.Description
End If


End Sub

Thanks for any help you can give.
 
6

'69 Camaro

Hi.
Thank you very much 69 Camaro for the help

You're welcome. Glad to help.
is there a code
I can use at log on that will open a certain form by user or group?

<Pet peave/>

When used as a noun, it isn't "a code," just like it's never "a money in your
pocket." Used as a noun, one may ask, "Is there code for logging the user out?"
Used as a modifier (adjective), one may ask, "Is there a code procedure for
opening this form invisibly?" or "Do you have a code snippet to delete the temp
file afterwards?"

</Pet Peave>

One may open a specific form when the database opens by running code that checks
the user's group membership. Typically, this is done with a splash screen as
the start up form. If you're not familiar with splash screens, please see the
following Web page for a link to the article, "Create Personalized Splash
Screens for Access":

http://www.Access.QBuilt.com/html/articles.html

Please see the following Web page for a link to the tip, "How to determine
whether a user is a member of a specific group," in the Security section:

http://www.Access.QBuilt.com/html/how-to_tips.html

Use the isMemberOfGrp( ) function to determine the user's membership in the
Admins group. Example procedure in the start up form's OnOpen( ) event or
OnTimer( ) event:

If (isMemberOfGrp(CurrentUser(), "Admins")) Then
DoCmd.OpenForm "frmAdminForm"
Else
DoCmd.OpenForm "frmDataEntryForm"
End If

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.


Thank you very much 69 Camoaro for the help....worked just as needed. I
have another issue I need clarification on. There are two people with
Admin privledges and 28 users with limited privledges, is there a code
I can use at log on that will open a certain form by user or group?
Thanks again you made my day.


'69 Camaro said:
Hi.
I have tried
numerous times using what I could find in this group as far as
instructions and no luck, there has to be some detail I'm missing.

Since you don't describe what error message or failures you're getting, "no
luck" doesn't really tell us what your problem might be. However, the
easiest
way to allow the user to change his own password is by putting a button on a
form, place [Event Procedure] in the button's OnClick( ) event, and paste
this
code in the form's module, ensuring the name of the button matches what is
ChgUsersPswdBtn in this example, then save and compile the code.

Private Sub ChgUsersPswdBtn_Click()

On Error GoTo ErrHandler

SendKeys "^+{TAB}", False
RunCommand acCmdUserAndGroupAccounts

Exit Sub

ErrHandler:

MsgBox "Error in ChgUsersPswdBtn_Click( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear

End Sub ' ChgUsersPswdBtn_Click( )

Open the form in Form View and select the button to open the Change Logon
Password dialog window.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.


I have a multi user database that is secure and split. I am looking for
the details of how to add a user password change form. I have tried
numerous times using what I could find in this group as far as
instructions and no luck, there has to be some detail I'm missing. The
following are the last instructions I've tried:

Create a form with the following textboxes:

Current User: set the Control Source =CurrentUser()
OldPW (old password)
NewPW (new password)
ConfirmPW (confirm password)


Add a command button, call it cmdSetPassword and drop in the following
procedure in the Click event


Private Sub cmdSetPassword_Click()
'Change the user's password. Confirm that the passwords typed are the
same.
Dim curr_user As User


On Error Goto FailedPW


If Me.NewPW <> Me.ConfirmPW Then
MsgBox "New passwords are not identical. Please retype
passwords and
try again.", _
vbOKOnly, "Change Password Failed"
Exit Sub
End If


If Len(Me.NewPW) < 4 Or Len(Me.NewPW) > 14 Or IsNull(Me.NewPW) Then

MsgBox "New passwords must be between 4 and 14 characters.",
vbOKOnly, "Change Password Failed"
Exit Sub
End If


Set curr_user = DBEngine.Workspaces(0).Users(CurrentUser())


If IsNull(Me.OldPW) Then
curr_user.NewPassword "", Me.NewPW
Else
curr_user.NewPassword Me.OldPW, Me.NewPW
End If


MsgBox "Your new password has been set and will take effect the
next
time you log on.", _
vbOKOnly, "Password confirmed"
DoCmd.RunCommand acCmdClose


Exit Sub


FailedPW:
If Err.Number = 3033 Then
MsgBox "Old password is incorrect. Please retype and try
again.",
vbOKOnly, "Change Password Failed"
Me.OldPW.SetFocus
Else
MsgBox "Error number " & Err.Number & ": " & Err.Description
End If


End Sub

Thanks for any help you can give.
 
6

'69 Camaro

Hi.

You may also be interested in the Security FAQ, which provides instructions on
securing your database and includes a number of handy code procedures. Please
see the following Web page for downloading the Security FAQ:

http://support.microsoft.com/?id=207793

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.


'69 Camaro said:
Hi.
Thank you very much 69 Camaro for the help

You're welcome. Glad to help.
is there a code
I can use at log on that will open a certain form by user or group?

<Pet peave/>

When used as a noun, it isn't "a code," just like it's never "a money in your
pocket." Used as a noun, one may ask, "Is there code for logging the user
out?" Used as a modifier (adjective), one may ask, "Is there a code procedure
for opening this form invisibly?" or "Do you have a code snippet to delete the
temp file afterwards?"

</Pet Peave>

One may open a specific form when the database opens by running code that
checks the user's group membership. Typically, this is done with a splash
screen as the start up form. If you're not familiar with splash screens,
please see the following Web page for a link to the article, "Create
Personalized Splash Screens for Access":

http://www.Access.QBuilt.com/html/articles.html

Please see the following Web page for a link to the tip, "How to determine
whether a user is a member of a specific group," in the Security section:

http://www.Access.QBuilt.com/html/how-to_tips.html

Use the isMemberOfGrp( ) function to determine the user's membership in the
Admins group. Example procedure in the start up form's OnOpen( ) event or
OnTimer( ) event:

If (isMemberOfGrp(CurrentUser(), "Admins")) Then
DoCmd.OpenForm "frmAdminForm"
Else
DoCmd.OpenForm "frmDataEntryForm"
End If

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.


Thank you very much 69 Camoaro for the help....worked just as needed. I
have another issue I need clarification on. There are two people with
Admin privledges and 28 users with limited privledges, is there a code
I can use at log on that will open a certain form by user or group?
Thanks again you made my day.


'69 Camaro said:
Hi.

I have tried
numerous times using what I could find in this group as far as
instructions and no luck, there has to be some detail I'm missing.

Since you don't describe what error message or failures you're getting, "no
luck" doesn't really tell us what your problem might be. However, the
easiest
way to allow the user to change his own password is by putting a button on a
form, place [Event Procedure] in the button's OnClick( ) event, and paste
this
code in the form's module, ensuring the name of the button matches what is
ChgUsersPswdBtn in this example, then save and compile the code.

Private Sub ChgUsersPswdBtn_Click()

On Error GoTo ErrHandler

SendKeys "^+{TAB}", False
RunCommand acCmdUserAndGroupAccounts

Exit Sub

ErrHandler:

MsgBox "Error in ChgUsersPswdBtn_Click( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear

End Sub ' ChgUsersPswdBtn_Click( )

Open the form in Form View and select the button to open the Change Logon
Password dialog window.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.


I have a multi user database that is secure and split. I am looking for
the details of how to add a user password change form. I have tried
numerous times using what I could find in this group as far as
instructions and no luck, there has to be some detail I'm missing. The
following are the last instructions I've tried:

Create a form with the following textboxes:

Current User: set the Control Source =CurrentUser()
OldPW (old password)
NewPW (new password)
ConfirmPW (confirm password)


Add a command button, call it cmdSetPassword and drop in the following
procedure in the Click event


Private Sub cmdSetPassword_Click()
'Change the user's password. Confirm that the passwords typed are the
same.
Dim curr_user As User


On Error Goto FailedPW


If Me.NewPW <> Me.ConfirmPW Then
MsgBox "New passwords are not identical. Please retype
passwords and
try again.", _
vbOKOnly, "Change Password Failed"
Exit Sub
End If


If Len(Me.NewPW) < 4 Or Len(Me.NewPW) > 14 Or IsNull(Me.NewPW) Then

MsgBox "New passwords must be between 4 and 14 characters.",
vbOKOnly, "Change Password Failed"
Exit Sub
End If


Set curr_user = DBEngine.Workspaces(0).Users(CurrentUser())


If IsNull(Me.OldPW) Then
curr_user.NewPassword "", Me.NewPW
Else
curr_user.NewPassword Me.OldPW, Me.NewPW
End If


MsgBox "Your new password has been set and will take effect the
next
time you log on.", _
vbOKOnly, "Password confirmed"
DoCmd.RunCommand acCmdClose


Exit Sub


FailedPW:
If Err.Number = 3033 Then
MsgBox "Old password is incorrect. Please retype and try
again.",
vbOKOnly, "Change Password Failed"
Me.OldPW.SetFocus
Else
MsgBox "Error number " & Err.Number & ": " & Err.Description
End If


End Sub

Thanks for any help you can give.
 

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

Similar Threads


Top