TrkItems.Item (method)

Item
Syntax: TrkItem = object.Item ( Index )
Parameters:
Index As Variant -
Index is the element key value in the collection. The data type for the Index argument can be any of the following: string, long, integer, unsigned integer, and unsigned long as a Variant value. The valid numeric index ranges from 1 to the total number of TrkItem objects in the collection.
Description:
If the Index is a string, it returns the TrkItem object with the specified name. If no such object exists in the collection, the method returns Nothing.

If the Index is a number, the method returns the TrkItem object from the given position in the collection. If the Index argument is greater than the number of items in the collection, or the collection is empty it returns Nothing.

Example 1:

Dim oTADBRoot As Object
Dim oTrkItem As Object
Dim idx As Long

Set oTADBRoot = CreateObject("TADB.TADBRoot")

If oTADBRoot Is Nothing Then
   MsgBox "Root Object is not created"
End If

oTADBRoot.Load "TRK7", ""

oTADBRoot.TrkItems.ReadDB
For idx = 1 To oTADBRoot.TrkItems.Count
   Set TrkItem = oTADBRoot.TrkItems.Item(idx)
   If Not oTrkItem Is Nothing Then
      ...
      ...
      ...
   Else
    'Item does not exist....
   End If
Next

Example 2:

Dim oTADBRoot As Object
Dim oTrkItem As Object
Dim idx As Long

Set oTADBRoot = CreateObject("TADB.TADBRoot")

If oTADBRoot Is Nothing Then
   MsgBox "Root Object is not created"
End If

oTADBRoot.Load "TRK7", ""

oTADBRoot.TrkItems.ReadDB
'Find Item ID "ABC" from Collection of TrkItems
Set TrkItem = oTADBRoot.TrkItems.Item("ABC")
If TrkItem Is Nothing Then
    'Item Not found
Else
    'Item Found ...
End If

Example 3:

Dim oTADBRoot As Object
Dim oTrkItem As Object
Dim idx As Long

Set oTADBRoot = CreateObject("TADB.TADBRoot")

If oTADBRoot Is Nothing Then
   MsgBox "Root Object is not created"
End If

oTADBRoot.Load "TRK7", ""

oTADBRoot.TrkItems.ReadDB
For Each oTrkItem In oTADBRoot.TrkItems
   MsgBox TrkItem.ID
   ...
   ...
Next