ListFieldCounter Object

SharePoint Designer Developer Reference

Contains information about the key counter used within the list.

Remarks

This field is created automatically by Office SharePoint Designer and cannot be modified by the user.

The following example displays the name associated with the counter field in the current list.

Visual Basic for Applications
Sub ListCounterFields()
'Displays the name of counter fields in the current list
    Dim objApp As Application
    Dim objField As ListField
    Dim strType As String
    Dim blnFound As Boolean
    blnFound = False
    Set objApp = Application
    If Not ActiveWeb.Lists Is Nothing Then
        For Each objField In objApp.ActiveWeb.Lists.Item(0).Fields
            'Check if it is a computed field of type FieldTypeCounter
            If objField.Type = FieldTypeCounter Then
                blnFound = True
                If strType = "" Then
                    'Create new string
                    strType = objField.Name & vbCr
                Else
                    'Add next field name to string
                    strType = strType & objField.Name & vbCr
                End If
            End If
        Next objField
        If blnFound = True Then
            MsgBox "The names of the fields in this list are: " & _
                    vbCr & strType
        Else
            MsgBox "There are no counter fields in the list."
        End If
    Else
        'Otherwise display message to user
        MsgBox "The current web site contains no lists."
    End If
End Sub

See Also