Sub CreateTable()
Dim cat As New ADOX.Catalog
Dim tbl As New ADOX.Table
cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\mydb.mdb;"
' Assign table name and some columns
With tbl
.Name = "NewTable"
.Columns.Append "Column1", adVarWChar, 250
.Columns.Append "Column2", adInteger
.Columns.Append "Column3", adInteger
End With
cat.Tables.Append tbl
End Sub
|