Inspection Details

IndexedUnboundDefaultMemberAccess


Summary
Identifies the use of indexed default member accesses for which the default member cannot be determined at compile time.
Reasoning
An indexed default member access hides away the actually called member. This is especially problematic if the default member cannot be determined from the declared type of the object. Should there not be a suitable default member at runtime, an error 438 'Object doesn't support this property or method' will be raised.
The following code example(s) would trigger this inspection:

Public Sub DoSomething(ByVal rst As Object)
    Dim bar As Variant
    bar = rst("MyField")
End Sub

The following code example(s) would not trigger this inspection:

Public Sub DoSomething(ByVal rst As Object)
    Dim bar As Variant
    bar = rst.Fields.Item("MyField")
End Sub


Back to List