改变ACCESS数据库的密码

2016-02-19 13:30 6 1 收藏

生活已是百般艰难,为何不努力一点。下面图老师就给大家分享改变ACCESS数据库的密码,希望可以让热爱学习的朋友们体会到设计的小小的乐趣。

【 tulaoshi.com - 编程语言 】

Public Function ChangeDatabasePassword(DBPath As String, _
newPassword As String, oldPassWord As String) As Boolean
   
`Usage: Change DatabasePassword
`Parameters: sDBPath: Full Path to Access Database

(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/bianchengyuyan/)

`newPassword: the password
`oldPassword: the previous password
`returns true on success false otherwise

If Dir(DBPath) = "" Then Exit Function

Dim db As DAO.Database

(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/bianchengyuyan/)

On Error Resume Next
Set db = OpenDatabase(DBPath, True, False, ";pwd=" & oldPassWord)
If Err.Number 0 Then Exit Function
db.newPassword oldPassWord, newPassword
ChangeDatabasePassword = Err.Number = 0
db.Close

End Function

来源:http://www.tulaoshi.com/n/20160219/1604494.html

经验教程

727

收藏

14
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部