CREATE VIEW Statement

Creates a new view (view (object): In an Access project, a type of query that is a virtual table based on an SQL SELECT statement. For example, a view might contain only 3 out of 10 available columns in a join of two tables, in order to limit access to certain data.).

 Note    The Microsoft Access database engine does not support the use of CREATE VIEW, or any of the DDL (Data Definition Language (DDL): The language used to describe database attributes, especially tables, fields, indexes, and storage strategy. ANSI defines this to have the tokens CREATE, DROP, and ALTER. DDL is a subset of structured query language (SQL).) statements, with non-Microsoft Access database engine databases.

Syntax

CREATE VIEW view [(field1[, field2[, ...]])] AS selectstatement

The CREATE VIEW statement has these parts:

Part Description
view The name of the view to be created.
field1, field2 The name of field or fields for the corresponding fields specified in selectstatement.
selectstatement A SQL SELECT statement.
Remarks

The SELECT statement that defines the view cannot be a SELECT...INTO statement.

The SELECT statement that defines the view cannot contain any parameters.

The name of the view (view (object): In an Access project, a type of query that is a virtual table based on an SQL SELECT statement. For example, a view might contain only 3 out of 10 available columns in a join of two tables, in order to limit access to certain data.) cannot be the same as the name of an existing table.

If the query defined by the SELECT statement is updatable, then the view is also updatable. Otherwise, the view is read-only.

If any two fields in the query defined by the SELECT statement have the same name, the view definition must include a field list specifying unique names for each of the fields in the query.

 
 
Applies to:
Access 2007