设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

创建一个带密码的空数据库

1970-1-1 08:00| 发布者: harsonliao| 查看: 2020| 评论: 0

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

最新评论

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2025-4-4 19:40 , Processed in 0.080885 second(s), 16 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

返回顶部