ActiveRecord Property

Applies To

MailMergeDataSource object.

Description

Returns or sets the active mail merge data record. Can be either a valid data record number in the query result or one of the following WdMailMergeActiveRecord constants: wdFirstRecord, wdLastRecord, wdNextRecord, wdNoActiveRecord, or wdPreviousRecord. Read/write Long.

Note The active data record number is the position of the record in the query result produced by the current query options; as such, this number isn't necessarily the position of the record in the data source.

See Also

DataSource property, FindRecord method, FirstRecord property, LastRecord property.

Example

This example hides the mail merge field codes in the active document so that the merge data is visible in the main document. The active record is then advanced to the next record in the data source.

If ActiveDocument.MailMerge.MainDocumentType <> wdNotAMergeDocument Then 
    With ActiveDocument.MailMerge
        .ViewMailMergeFieldCodes = False
        .DataSource.ActiveRecord = wdNextRecord
    End With
End If
This example returns the active data record from Main2.doc.

If Documents("Main2.doc").MailMerge.State = wdMainAndDataSource Or _
    wdMainAndSourceAndHeader Then
num = Documents("Main2.doc").MailMerge.DataSource.ActiveRecord
End If