Add Method (PageFields Collection)

                  Applies To

Creates a new page field. Returns a PageField object.

Syntax

expression.Add(Source, FieldType, Name, TotalType, Index)

expression   An expression that returns a PageFields object.

Source   Required Variant. Specifies the source for the new page field. For new fields of type dscOutput, this argument specifies a SchemaField object or the name of a schema field. For fields of type dscCalculated, this argument specifies the expression for the calculated field. For new fields of type dscGrouping, this argument specifies a PageField object or the name of a page field on which this grouping is based

FieldType   Optional Variant. Specifies the new field type. The default value and allowed values depend on the parent object used with this method. For more information, see the “Remarks” section in this topic.

Name   Optional Variant. Specifies the name of the new page field. If you do not specify this argument, the name of an output field is the same as the schema field it is based on, the name of a grouping field is "By<pagefieldname>" or "<agg function>of<pagefieldname>", and the name of a calculated field is "Expr". In all cases, numerals are automatically appended to the new name to make it unique, if necessary.

TotalType   Optional dscTotalTypeEnum. The default value is dscNone.

Index   Optional Variant. Specifies the ordinal position, the name, or the actual object reference for the page field before which the new page field is added. If you do not specify this argument, the new page field is added at the end of the collection. You use this argument only with a GroupingDef object's PageFields collection. For more information, see the “Remarks” section following this paragraph.

Remarks

The PageFields collection has three different parent objects: RecordsetDef, PageRowsource, and GroupingDef. You use the same Add method for all of these parent objects. There are, however, some differences in defaults and allowed values depending on which parent object you use.