How can I insert a description for a column in an Access table using SQL?
I do:
CREATE TABLE TAB_A (COLUMN1 TEXT(30), COLUMN2 REAL, PRIMARY KEY (COL
You can't do it in SQL.
KB210314: ACC2000: How to Use ADO or DAO to Retrieve a Field's Description
I reckon that it can be set the same way that it can be retrieved:
Function SetFieldDesc_ADO(ByVal MyTableName As String, ByVal MyFieldName As String, ByVal Description As String)
Dim MyDB As New ADOX.Catalog
Dim MyTable As ADOX.Table
Dim MyField As ADOX.Column
On Error GoTo Err_SetFieldDescription
MyDB.ActiveConnection = CurrentProject.Connection
Set MyTable = MyDB.Tables(MyTableName)
MyTable.Columns(MyFieldName).Properties("Description").Value = Description
Set MyDB = Nothing
Bye_SetFieldDescription:
Exit Function
Err_SetFieldDescription:
MsgBox Err.Description, vbExclamation
Resume Bye_SetFieldDescription
End Function
Dim col As ADOX.Column = New ADOX.Column
With col
.Name = name
.Type = type
.DefinedSize = size
.ParentCatalog = cat
.Properties("Description").Value = description
End With