Database Objects
Hi-Integrity Systems
HomeVB6 Documentation › DBO.ObjectByKey

DatabaseObjects

ObjectByKey(ByVal objCollection As IDatabaseObjects, ByVal vKey As Variant) As IDatabaseObject

ObjectByKey returns an object from the collection using a unique key value. The key must be unique within the collection. If the collection's IDatabaseObjects_Subset has been implemented then the key need only be unique within the subset not the entire table. vKey is the value for the field defined by the collection's IDatabaseObjects_KeyFieldName.

Dim objProduct As Product 'Assume that the objGlobalProductsInstance's IDatabaseObjects_KeyFieldName 'has been set to ProductCode. Return the product with a product code of "PC123" Set objProduct = DBO.ObjectByKey(objGlobalProductsInstance, "PC123")