改正工作组用户密码[Access防范]
本文“改正工作组用户密码[Access防范]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
下面是改正工作组用户密码的函数,调用时假如用于密码为空,请利用"",不要利用null,二者差别.:)
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", "")
'//要分外注意上面一句,必须利用拥有数据库管理权限的用户名和密码掀竣工作区!
'//下面一段是查找用户名能否存在,假如存在,改正密码,不存在出错报告.
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 & "' 不是一个有效的用户名!",_
VBExclamation, "艾赛思利用网"
CheckUserPasswordInGroup = False
Exit Function
End If
CheckUserPasswordInGroup = True
Exit Function
ChkErr:
MsgBox "'" & UserName & "' 用户密码改正失利!",_
vbExclamation, "艾赛思利用网"
CheckUserPasswordInGroup = False
End Function
以上是“改正工作组用户密码[Access防范]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |