ForEachRecord data block

Applies to: Access 2013, Office 2013

A ForEachRecord data block repeats a set of statements for each record in a domain.

Note

The ForEachRecord data block is available only in Data Macros.

Setting

The ForEachRecord action has the following arguments.

Argument

Required

Description

In

Yes

A string that identifies the domain of records to operate on. The In argument can contain the name of the table, a select query, or a SQL statement.

NOTE: The specified domain cannot include data stored in a linked table or ODBC data source.

Where Condition

No

A string expression used to restrict the range of data on which the ForEachRecord data block is performed. For example, criteria is often equivalent to the WHERE clause in an SQL expression, without the word WHERE. If criteria is omitted, the ForEachRecord data block operates on the entire domain specified by the In argument. Any field that is included in criteria must also be a field in In.

Alias

No

A string that provides an alternative name for the domain specified by the In argument. Often used to shorten the table name for subsequent references to prevent possible ambiguous references.If Alias is not specified, the table or query name will be used as the alias.

Remarks

Use the ExitForEachRecord action to exit a ForEachRecord data block immediately.