Add new property to TableDef : TableDefs « Access « VBA / Excel / Access / Word






Add new property to TableDef

 

Sub exaUserDefinedProperty()
    Dim db As Database
    Dim tbl As TableDef
    Dim prp As Property
     
    Set db = CurrentDb
    Set tbl = db!BOOKS
     
    Set prp = tbl.CreateProperty("UserProperty", dbText, "Programming DAO is fun.")
    tbl.Properties.Append prp
    For Each prp In tbl.Properties
       Debug.Print prp.Name
       Debug.Print prp.Value
       Debug.Print prp.Type
       Debug.Print prp.Inherited
    Next prp
     
    Debug.Print tbl.Properties.Count
     
End Sub

 








Related examples in the same category

1.Database relations
2.Reference column name from TableDefs
3.List table properties
4.Create a relation
5.Create an index
6.Create new field with validation rule