Udostępnij za pośrednictwem


Criteria Pane

The Criteria pane allows you to specify query options — such as which data columns to display, how to order the results, and what rows to select — by entering your choices into a spreadsheet-like grid. In the Criteria pane you can specify:

  • Columns to display and column name aliases.

  • The table that a column belongs to.

  • Expressions for calculated columns.

  • The sort order for the query.

  • Search conditions.

  • Grouping criteria, including aggregate functions to use for summary reports.

  • New values for Update or Insert Into queries.

  • Target column names for Insert From queries.

Changes you make in the Criteria pane are automatically reflected in the Diagram pane and SQL pane. Similarly, the Criteria pane is updated automatically to reflect changes made in the other panes.

Note

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

About the Criteria Pane

The rows in the Criteria pane display the data columns used in your query; columns in the Criteria pane display query options.

The specific information that appears in the Criteria pane depends on the type of query you are creating. If you are creating a Select query, the Criteria pane contains different columns than if you are creating an Update query.

The following table lists the grid columns that can appear in the Criteria pane.

Column

Query type

Description

Column

All

Displays either the name of a data column used for the query or the expression for a computed column. This column is locked so that it is always visible as you scroll horizontally.

Alias

Select, Insert From, Update, Make Table

Specifies either an alternate name for a column or the name you can use for a computed column.

Table

Select, Insert From, Update, Make Table

Specifies the name of the table or table-structured object for the associated data column. This column is blank for computed columns.

Output

Select, Insert From, Make Table

Specifies whether a data column appears in the query output.

Note

If the database allows, you can use a data column for sort or search clauses without displaying it in the result set.

Sort Type

Select, Insert From

Specifies that the associated data column is used to sort the query results and whether the sort is ascending or descending.

Sort Order

Select, Insert From

Specifies the sort priority for data columns used to sort the result set. When you change the sort order for a data column, the sort order for all other columns is updated accordingly.

Group By

Select, Insert From, Make Table

Specifies that the associated data column is being used to create an aggregate query. This grid column appears only if you have chosen Group By from the Tools menu or have added a GROUP BY clause to the SQL pane.

By default, the value of this column is set to Group By, and the column becomes part of the GROUP BY clause.

When you move to a cell in this column and select an aggregate function to apply to the associated data column, by default the resulting expression is added as an output column for the result set.

Criteria

All

Specifies a search condition (filter) for the associated data column. Enter an operator (the default is "=") and the value to search for. Enclose text values in single quotation marks.

If the associated data column is part of a GROUP BY clause, the expression you enter is used for a HAVING clause.

If you enter values for more than one cell in the Criteria grid column, the resulting search conditions are automatically linked with a logical AND.

To specify multiple search condition expressions for a single database column (for example, (fname > 'A') AND (fname < 'M'), add the data column to the Criteria pane twice and enter separate values in the Criteria grid column for each instance of the data column.

Or...

All

Specifies an additional search condition expression for the data column, linked to previous expressions with a logical OR. You can add more Or... grid columns by pressing the TAB key in the rightmost Or... column.

Append

Insert From

Specifies the name of the target data column for the associated data column. When you create an Insert From query, the Query and View Designer attempts to match the source to an appropriate target data column. If the Query and View Designer cannot choose a match, you must provide the column name.

New Value

Update, Insert Into

Specifies the value to place into the associated column. Enter a literal value or an expression.

See Also

Tasks

How to: Specify Search Conditions

Concepts

Rules for Entering Search Values

Reference

Diagram Pane

Results Pane

SQL Pane

Other Resources

Designing Queries and Views

Sorting and Grouping Query Results