Item

ACCPAC Common Controls

AccpacViewFields.Item

Returns a specific AccpacViewField object in the collection, specified by its 0-based index in the collection or by its field name.

Function Item(pIndex As Variant) As AccpacViewField
(default)

Parameters

pIndex

[in] the index of the AccpacViewField object in the 0-based collection, or the field name

Return Value

Returns the AccpacViewField object corresponding to the supplied index.

Remarks

Because the Item method is the default method for this collection, you do not have to specify "Item." For example, the following syntax forms are interchangeable:

Field.Item(0)
Fields(0)
Fields.Item("name")
Fields("name")

Note that the index denotes the position of the field stored in the collection, and does not represent the field ID defined in the view.

Example

The following example retrieves the NAME field from the Bank Account's fields collection:
 

Dim BKACCT1header As AccpacCOMAPI.AccpacView

mDBLinkCmpRW.OpenView "BK0001", BKACCT1header

Dim fldBANK As AccpacCOMAPI.AccpacViewField

Set fldBANK = BKACCT1header.Fields("BANK")