Dim oCat As ADOX.Catalog
Dim oTable As ADOX.Table
Dim oColumn As ADOX.Column
Dim oKey As ADOX.Key
' Delete any previous temp file
On Error Resume Next
Kill ".\new35.mdb"
On Error GoTo 0
' Create a new database in 3.5 format (Access 97)
Set oCat = New ADOX.Catalog
oCat.Create "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=.\new35.mdb;" & _
"Jet OLEDB:Engine Type=4;"
' Create a new Table
Set oTable = New ADOX.Table
oTable.Name = "WebSite"
oCat.Tables.Append oTable
' Create a new AutoNumber ID Column
Set oColumn = New ADOX.Column
With oColumn
.Name = "WebSiteID"
.Type = adInteger
Set .ParentCatalog = oCat ' Must set before setting properties
.Properties("Autoincrement") = True
End With
oCat.Tables("WebSite").Columns.Append oColumn
' Create a new Primary Key for the table
Set oKey = New ADOX.Key
With oKey
.Name = "PrimaryKey"
.Type = adKeyPrimary
.RelatedTable = "WebSite"
.Columns.Append "WebSiteID"
End With
oCat.Tables("WebSite").Keys.Append oKey