Changing User Password

B

bigturnip

I am banging my head against a brick wall here, probably a simpl
answer, I have the following code and know that it works except
don't know how to set UsrPwd to the current user. I can us
.createuser and the rest of the code then works, but I don't want t
create a new user and the CurrentUser method gives a type mismatch.

I am using Access 2002 on Windows XP and the DAO 3.6 object library.
Any help would be appreciated.

Sub ChangePassword()

Dim wrkspc As Workspace
Dim UsrPwd As User
Dim strPasswordOld As String
Dim strPassword As String
Dim strPasswordConfirm As String

' Get default workspace.
Set wrkspc = DBEngine.Workspaces(0)
Set UsrPwd =
With wrkspc

strPasswordOld = InputBox("Enter old password")
strPassword = InputBox("Enter new password")
strPasswordConfirm = InputBox("Confirm new password")

If LCase(strPassword) <> LCase(strPasswordConfirm) Then
MsgBox "New Password did not match"
Exit Sub
End If

Select Case Len(strPassword)
Case 1 To 14
UsrPwd.newpassword strPasswordOld, LCase(strPassword)
MsgBox "Password changed!"
Case Is > 14
MsgBox "Password too long!"
Case 0
End Select


End With

End Sub
 

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

Top