By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,361 Members | 3,185 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,361 IT Pros & Developers. It's quick & easy.

Whats the easiest way to allow a user to change password in an A97 app?

P: n/a
MLH
What's the simplest way to allow a user
of an A97 app to change password?
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"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
Nov 13 '05 #2

P: n/a
MLH
Thx, Justin... this was just the code I needed!
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

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


Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.