Private Sub Command1_Click()
Dim wrkDefault As Workspace
Dim dbsNew As Database
Dim tdfNew As TableDef
Dim NewDB As Database
If Dir("D:\NewDB.mdb") <> "" Then Kill "D:\NewDB.mdb"
'{取当前目录的话去掉路径: If Dir("NewDB.mdb") <> "" Then Kill "NewDB.mdb")}
Set wrkDefault = DBEngine.Workspaces(0)
Set dbsNew = wrkDefault.CreateDatabase("d:\NewDB.mdb", dbLangGeneral, dbEncrypt)
'{取当前目录的话去掉路径: Set dbsNew = wrkDefault.CreateDatabase("NewDB.mdb", dbLangGeneral, dbEncrypt)}
dbsNew.NewPassword "", "123" '设置数据库密码为123
Set wrkDefault = Nothing
Set dbsNew = Nothing
End Sub
……