First quote McrSoft DAO 3.6 (or 2.5 or 3.51) Object Library and McRSoft Access 9.0 Object Library, add a command1 on the Form, paste the following code:
Private Sub Command1_Click () DIM WRKDEFAULT AS WORKSPACE DIM DBSNEW AS DATABASE DIM TDFNEW AS TABEDEF DIM NewDB As Database
IF DIR ("D: /Newdb.mdb") <> "" "D: /Newdb.mdb"
'{Take the current directory to remove the path: if Dir ("newdb.mdb") <> "" "" newdb.mdb ")}
Set WRKDEFAULT = DBENGINE.WORKSPACES (0)
Set dbsnew = WRKDEFAULT.CREATEDATABASE ("D: /Newdb.mdb", DBLANGGeneral, Dbencrypt)
'{Take the current directory to remove the path: set dbsnew = wrkdefault.createdDatabase ("newdb.mdb", dblangGeneral, dbencrypt)}
dbsnew.newpassword "" "," 123 "set the database password is 123
Set WRKDEFAULT = Nothing
Set dbsnew = Nothing
End Sub