Each DAO object has an associated Properties collection. This collection contains the Property objects that identify each characteristic of the object. Like other collections, you can iterate through the collection and refer to specific elements. You refer to Property objects and Properties collections by using the same syntax as you do for other DAO collections:
For example, to refer to the value of the Type property of the CustomerID field in the Customers table, you could use any of the following lines of code, where dbs
is a Database object:
dbs.TableDefs("Customers").Fields("CustomerID").Properties("Type").Value dbs.TableDefs("Customers").Fields("CustomerID").Properties(strType).Value dbs.TableDefs("Customers").Fields("CustomerID").Properties(3).Value
In the second line of code, a string variable, strType
, is set to the value of "Type"
.
In the last line, the code assumes that the Type property is always going to be in the fourth position in the Properties collection. As mentioned earlier in the “Objects and Collections” section, you should not rely on an object’s position within its collection. The only time you would refer to a property by its index number is when you are iterating through all the Properties in a collection.