打印本文 打印本文  关闭窗口 关闭窗口  
创建带密码的空数据库
作者:佚名  文章来源:不详  点击数  更新时间:2008/4/18 14:54:56  文章录入:杜斌  责任编辑:杜斌

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 
打印本文 打印本文  关闭窗口 关闭窗口