創(chuàng)建一個帶密碼的空數(shù)據(jù)庫
來源:程序員人生 發(fā)布時間:2014-05-24 01:18:25 閱讀次數(shù):3564次
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
生活不易,碼農(nóng)辛苦
如果您覺得本網(wǎng)站對您的學習有所幫助,可以手機掃描二維碼進行捐贈