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", "")
'//要特別注意上面一句,必須使用擁有數(shù)據(jù)庫管理權(quán)限的用戶名和密碼打開工作區(qū)!
'//下面一段是查找用戶名是否存在,如果存在,修改密碼,不存在出錯(cuò)報(bào)告。
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 & "' 不是一個(gè)有效的用戶名!",_
vbexclamation, "艾賽思應(yīng)用網(wǎng)"
checkuserpasswordingroup = false
exit function
end if
checkuserpasswordingroup = true
exit function
chkerr:
msgbox "'" & username & "' 用戶密碼修改失敗!",_
vbexclamation, "艾賽思應(yīng)用網(wǎng)"
checkuserpasswordingroup = false
end function
新聞熱點(diǎn)
疑難解答
圖片精選