Share via


CreateRecord Data Block

You can use the CreateRecord data block to create a new record in the specified table.

Note

The CreateRecord data block is available only in Data Macros.

Setting

The CreateRecord data block has the following arguments.

Argument

Required

Description

Create a Record In

Yes

The name of the table to create the new record in.

Alias

No

An string that identifies the record. You can use the record's alias to identify

Remarks

The record created by CreateRecord automatically becomes the current record.

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

CancelRecordChange Macro Action

Comment Macro Statement

Group Macro Statement

If...Then...Else Macro Statement

SetField Macro Action

SetLocalVar Macro Action

After the CreateRecord action creates a record, use the SetField action to specify a value of a field in the new record.

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

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

Once the new record is committed, you can use the LastCreateRecordIdentity local variable to work with the record. For example, use the following syntax to 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.