MailMergeDataSource.EditRecord Method (Publisher)

Changes one of the data fields in one of the records in the master data source (the combined mail-merge recipient list).

Version Information

Version Added: Publisher 2007

Syntax

expression .EditRecord(lRec, varField, Value)

expression A variable that represents a MailMergeDataSource object.

Parameters

Name

Required/Optional

Data Type

Description

lRec

Required

Long

The ID of the record you want to edit.

varField

Required

Variant

The data field (column) that contains the value you want to change.

Value

Required

Variant

The value to be changed.

Remarks

You can use the EditRecord method to correct data source information that is in error, such as an outdated recipient address.

The EditRecord method does not make any changes to the individual data sources that together make up the master data source.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the EditRecord method to change the value of a single column in a particular record in the master data source (the combined mail-merge recipient list).

Before running this macro, replace recordID with the index number of the record in the data source that you want to edit; replace fieldname with the name of the field (column) in the record that you want to edit; and replace value with the new value you want to set for the field.

Public Sub EditRecord_Example() 
 
 Dim pubMailMergeDataSource As Publisher.MailMergeDataSource 
 
 Set pubMailMergeDataSource = ThisDocument.MailMerge.DataSource 
 
 pubMailMergeDataSource.EditRecord recordID, "fieldname", "value" 
 
End Sub