CreateRecord Data Block (Access custom web app)

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

Important

Microsoft no longer recommends creating and using Access web apps in SharePoint. As an alternative, consider using Microsoft PowerApps to build no-code business solutions for the web and mobile devices.

Note

The CreateRecord data block is available only in Data Macros.

Setting

The CreateRecord data block has the following arguments.

The CreateRecord data block has the following arguments.

Argument name Required Description
Create a Record In
Yes
The name of the table to create the new record in.
Alias
No
A 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 committed. The following actions are available in a CreateRecord data block.

Action
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 statement 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 refer to the AssignedTo field of the most recently created record.

[LastCreateRecordIdentity].[AssignedTo]