EditRecord data block

Applies to: Access 2013, Office 2013

You can use the EditRecord data block to change the values contained in an existing record.

Note

The EditRecord data block is available only in Data Macros.

Setting

The EditRecord data block has the following arguments.

Argument

Description

Alias

A string that identifies the record to edit. If the Alias argument is not specified, then the current record is edited.

Remarks

After EditRecord statement, you can insert a block of commands that will execute before the changes to the record are comitted. The following actions are available in a EditRecord data block.

CancelRecordChange macro action

Comment macro statement

Group macro statement

If...Then...Else macro statement

SetField macro action

SetLocalVar macro action

Use the SetField action to specify the new values of a field in the edited record.

You can use an If...Then...Else statment to perform operations based on a condition.

To cancel the editing of a record, use the CancelRecordChange action. This prevents the changes from being committed and exits the EditRecord data block.

You can use the LastCreateRecordIdentity local variable to work with last record created in a CreateRecord data block. For example, use the following syntax to refer to the AssignedTo field of the most recently created record:

[LastCreateRecordIdentity].[AssignedTo]

The CreateRecord data block can only be used in the After Insert, After Update, and After Update data macro events.