Submitted By: Martijn Haverhoek

Creates a Microsoft Access database.

Visual Basic
Edit|Remove
'Create MDB with ADO (ADOX)
'At least MDAC2.0 is required to the code. 

Const Jet10 = 1
Const Jet11 = 2
Const Jet20 = 3
Const Jet3x = 4
Const Jet4x = 5

Sub CreateNewMDB(FileName, Format)
  Dim Catalog
  Set Catalog = CreateObject("ADOX.Catalog")
  Catalog.Create "Provider=Microsoft.Jet.OLEDB.4.0;" & _
     "Jet OLEDB:Engine Type=" & Format & _
    ";Data Source=" & FileName
End Sub


'Create Access2000 database
CreateNewMDB "MigrateHomePath.mdb", Jet4x