Shape commands in general

Applies to: Access 2013, Office 2013

Data shaping defines the columns of a shaped Recordset, the relationships between the entities represented by the columns, and the manner in which the Recordset is populated with data.

A shaped Recordset may consist of the following types of columns.

Column type

Description

data

Fields from a Recordset returned by a query command to a data provider, table, or previously shaped Recordset.

chapter

A reference to another Recordset, called a chapter. Chapter columns make it possible to define a parent-child relationship where the parent is the Recordset containing the chapter column and the child is the Recordset represented by the chapter.

aggregate

The value of the column is derived by executing an aggregate function on all the rows or a column of all the rows of a child Recordset. (See Aggregate Functions in the following topic, Aggregate Functions, the CALC Function, and the NEW Keyword.)

calculated expression

The value of the column is derived by calculating a Visual Basic for Applications expression on columns in the same row of the Recordset. The expression is the argument to the CALC function. (See Calculated Expression in the following topic, Aggregate Functions, the CALC Function, and the NEW Keyword and in Visual Basic for Applications Functions.)

new

Empty, fabricated fields, which may be populated with data at a later time. The column is defined with the NEW keyword. (See NEW keyword in the following topic, Aggregate Functions, the CALC Function, and the NEW Keyword.)

A shape command may contain a clause specifying a query command to an underlying data provider that will return a Recordset object. The query's syntax depends on the requirements of the underlying data provider. This will usually be Structured Query Language (SQL), although ADO does not require the use of any particular query language.

You could use a SQL JOIN clause to relate two tables; however, a hierarchical Recordset may represent the information more efficiently. Each row of a Recordset created by a JOIN repeats information redundantly from one of the tables. A hierarchical Recordset has only one parent Recordset for each of multiple child Recordset objects.

Shape commands can be issued by Recordset objects or by setting the CommandText property of the Command object and then calling the Execute method.

Shape commands can be nested. That is, the parent-command or child-command may itself be another shape command.

The shape provider always returns a client cursor, even when the user specifies a cursor location of adUseServer.

For information about navigating a hierarchical Recordset, see Accessing Rows in a Hierarchical Recordset.

For precise information about syntactically correct shape commands, see Formal Shape Grammar.

See also