Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add a popup for users to change database password

Status
Not open for further replies.

OverDrive

IS-IT--Management
Dec 11, 2000
268
US
Is there any easy way to create a popup so as users have the option to be able to change their database password without getting into the design view?

I know it will contain a popup form . . . I have that created, I just need guidance on how to program it so as to make it work.

Thanks,
OverDrive

If it is a large code issue, my email address is:
chance@iland.net
and also send it to
chad.bixby@whiteman.af.mil
 
A solution:

1 TextBox: TxtUser Control Source: =CurrentUser() Disabled
1 TextBox: TxtOldPW InputMask: Password
1 TextBox: TxtNewPW as above
1 TextBox: TxtVerPW as above
1 CommandButton: CmdOK Caption "OK"
1 CommandButton: CmdCancel Caption "Cancel"

Private Sub CmdCancel_Click
On Error Resume Next
DoCmd.Close
End sub

Private Sub CmdOK_Click()
Dim strUser As String, strPW As String, strOPW As String
On Error GoTo ERRPW

If Me.TxtNewPW <> Me.TxtVerPW Then
MsgBox &quot;Please make sure you have typed your new password and verification password correctly.&quot;, vbInformation, &quot;Password verification.&quot;
Exit Sub
End If
If Len(Me.TxtNewPW) > 10 Then
MsgBox &quot;The password cannot exceed 10 characters in length.&quot;, vbInformation, &quot;Password Length Verification.&quot;
Exit Sub
End If
strUser = CStr(CurrentUser())
strPW = Me.TxtNewPW
strOPW = &quot;&quot;
If Not IsNull(Me.TxtOldPW) Then strOPW = Me.TxtOldPW
DBEngine.Workspaces(0).Users(strUser).NewPassword strOPW, strPW
Me.TxtOldPW = Null
Me.TxtNewPW = Null
Me.TxtVerPW = Null
DoCmd.Close

ExitPW:
Exit Sub

ERRPW:
MsgBox Err.Number & &quot; &quot; & Err.Description,vbInformation,&quot;Password Update Error.&quot;
Resume ExitPW
End Sub

Enjoy! Gord
ghubbell@total.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top