Set column properties by using ADOX.Table
ADO Equivalents to Access Data Types
Microsoft Access Data Type ADO Equivalent
Binary adBinary
Boolean adBoolean
Byte adUnsignedTinyInt
Currency adCurrency
Date adDate
Numeric adNumeric
Double adDouble
Small Integer adSmallInt
Integer adInteger
Long Binary adLongBinary
Memo adLongVarWChar
Single adSingle
Text adWChar
Sub makeTable()
Dim currCat As New ADOX.Catalog
Dim newTable As New ADOX.Table
Dim newKey As New ADOX.Key
currCat.ActiveConnection = CurrentProject.Connection
With newTable
.Name = "tblTestTable"
.Columns.Append "custNumber", adInteger
.Columns("custNumber").ParentCatalog = currCat
.Columns("custNumber").Properties("AutoIncrement") = True
newKey.Name = "PrimaryKey"
newKey.Columns.Append "custNumber"
.Keys.Append newKey, adKeyPrimary
.Columns.Append "custFirstName", adWChar
.Columns.Append "custLastName", adWChar
End With
currCat.Tables.Append newTable
Set currCat = Nothing
End Sub
Related examples in the same category