FindRecord Method

Applies To

MailMergeDataSource object.

Description

Searches the contents of the specified mail merge data source for text in a particular field. Returns True if the search text is found.

Note Corresponds to the Find Record button on the Mail Merge toolbar.

Syntax

expression.FindRecord(FindText, Field)

expression Required. An expression that returns a MailMergeDataSource object.

FindText Required String. The text to be looked for.

Field Required String. The name of the field to be searched.

See Also

ActiveRecord property, DataSource property, FirstRecord property, LastRecord property.

Example

This example displays a merge document for the first data record in which the FirstName field contains "Joe." If the data record is found, the number of the record is stored in the numRecord variable.

ActiveDocument.MailMerge.ViewMailMergeFieldCodes = False
Set myMMData = ActiveDocument.MailMerge.DataSource
If myMMData.FindRecord(FindText:="Joe", Field:="FirstName") = True Then
    numRecord = myMMData.ActiveRecord
End If