VB Code:
'Add a reference to Microsoft ADO Ext. X.X For DLL And Security
Option Explicit
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Private Sub Command1_Click()
Set cat = New ADOX.Catalog
Set tbl = New ADOX.Table
' create the db
cat.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\newDB3.mdb"
With tbl
.Name = "TestTable"
' Create fields and append them to the
' Columns collection of the new Table object.
With .Columns
.Append "ID COLUMN"
.Append "SetName", adVarWChar, 255
.Append "SetVal", adVarWChar, 255
.Append "Description", adVarWChar, 255
End With
End With
' Add the new Table to the Tables collection of the database.
cat.Tables.Append tbl
'Set AllowZeroLength to true for the SetName field
tbl.Columns("SetName").Properties("Jet OLEDB:Allow Zero Length") = True
Set cat = Nothing
Set tbl = Nothing
End Sub