创建一数据库

Private Sub Form_Load()
    Dim newWS As Workspace
    Dim newDB As Database
    Randomize

    Set newWS = DBEngine.Workspaces(0)
    Set newDB = newWS.CreateDatabase(IIf(Right(App.Path, 1) = "\", App.Path, App.Path & "\") & "Newdb_" & Mid(Rnd, 3, 5) & ".mdb", dbLangGeneral & ";pwd=123", dbEncrypt)
End Sub

你可能感兴趣的:(数据库)