Modify Workgroup User Password

Source: Internet
Author: User
Tags exit modify
The following is a function that modifies a workgroup user's password, using "" instead of NULL when invoked when the password is null, which is different. :)

Function Checkuserpasswordingroup (UserName as String,_
OldPassword As String, NewPassword as String) as Boolean
On Error GoTo Chkerr
Dim wk as DAO. Workspace, Ur as DAO. User, I as Integer, Found as Boolean
Checkuserpasswordingroup = False
Found = False
Set wk = Dbengine.createworkspace ("", "Admin", "")
'//To pay special attention to the above sentence, you must open the workspace with a username and password that has the database Admin permissions!

'//The following paragraph is to find out if the user name exists, if it exists, modify the password, there is no error reporting.
For i = 0 to wk. Users.count-1
If wk. Users (i). Name = UserName Then
Set Ur = wk. Users (i)
Found = True
Ur.newpassword OldPassword, NewPassword
Exit for
End If
Next I

If not Found Then
MsgBox "'" & UserName & "' is not a valid username! ",_
vbexclamation, "Aysais Application Network"
Checkuserpasswordingroup = False
Exit Function
End If
Checkuserpasswordingroup = True
Exit Function
Chkerr:
MsgBox "'" & UserName & ' user password modification failed! ",_
vbexclamation, "Aysais Application Network"
Checkuserpasswordingroup = False
End Function



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.