创建一个带密码的空数据库
来源:程序员人生 发布时间:2014-05-24 01:18:25 阅读次数:3383次
Function CreatePasswordDB(strPathName As String, strPsd As String) As Boolean
On Error GoTo Exit_ERR
Dim wrkDefault As Workspace
Dim NewDB As Database
CreatePassWordDB = False
Set wrkDefault = DBEngine.Workspaces(0)
If Dir(strPathName) <> "" Then Kill strPathName
Set NewDB = wrkDefault.CreateDatabase(strPathName, dbLangGeneral & ";pwd=" & strPsd & "")
NewDB.Close
Set NewDB = Nothing
CreatePassWordDB = True
Exit Function
Exit_ERR:
MsgBox "备份失败!" & VBCrLf & vbCrLf & Err.Description, vbExclamation
Exit Function
End Function
生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠