VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)
首页 - 经验之谈 - 改变ACCESS数据库的密码
发表评论(0)作者:不详, 平台:VB6.0+Win98, 阅读:11315, 日期:2001-04-08
Public Function ChangeDatabasePassword(DBPath As String, _
newPassword As String, oldPassWord As String) As Boolean
    
`Usage: Change DatabasePassword
`Parameters: sDBPath: Full Path to Access Database
`newPassword: the password
`oldPassword: the previous password
`returns true on success false otherwise

If Dir(DBPath) = "" Then Exit Function

Dim db As DAO.Database

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