I'm trying to find some way to change the password of a user given I don't know their password, in code. So it is something like running "User and Group Accounts", then selecting a user, then clicking the clear button, then setting a new password.
I've tried using ALTER USER command, but it requires an old password. I also tried using a routine from SECFAQ.doc, called faqChangePassword. "In Theory" it is suppose to allow you to change a user's password if the person running the routine has "Admins" rights. I do belong to the "Admins" group, however, I get an error 3033, "You do not have permissions to use the <user name> object. Have your system administrator or the person who created this object establish the appropriate permissions for you."
The routine I'm using is:
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
It works if I don't have a password, but if I already have a password it does not work.
Regards,
Leif
I've tried using ALTER USER command, but it requires an old password. I also tried using a routine from SECFAQ.doc, called faqChangePassword. "In Theory" it is suppose to allow you to change a user's password if the person running the routine has "Admins" rights. I do belong to the "Admins" group, however, I get an error 3033, "You do not have permissions to use the <user name> object. Have your system administrator or the person who created this object establish the appropriate permissions for you."
The routine I'm using is:
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
It works if I don't have a password, but if I already have a password it does not work.
Regards,
Leif