In VBA there are at least three possible ways of doing this - using DAO,
using ADOX, or using a DDL query. I would imagine the first two could be
done from .NET via com interop, but I have not tested this. The DDL method
should certainly work.
Public Sub CreateTables()
'DAO
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Set db = CurrentDb
Set tdf = db.CreateTableDef("FirstTable")
Set fld = tdf.CreateField("TestField", dbText, 50)
tdf.Fields.Append fld
db.TableDefs.Append tdf
'ADOX
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Dim col As ADOX.Column
Set cat = New ADOX.Catalog
Set cat.ActiveConnection = CurrentProject.Connection
Set col = New ADOX.Column
With col
.Name = "TestField"
.Type = adVarWChar
.DefinedSize = 50
End With
Set tbl = New ADOX.Table
With tbl
.Name = "SecondTable"
.Columns.Append col
End With
cat.Tables.Append tbl
'DDL
CurrentProject.Connection.Execute "CREATE TABLE ThirdTable (TestField
VARCHAR(50))"
End Sub