Microsoft Office Tutorials and References
In Depth Information
In Design view, the Select Query window contains the standard title bar, the menu bar,
the status bar, and the Query Design toolbar. On the toolbar, the Query Type button
shows a select query; the icon on this button changes according to the type of query you
are creating. The title bar on the Select Query window displays the query type (Select
Query) and the default query name (Query1). You’ll change the default query name to a
more meaningful one later when you save the query.
The Select Query window in Design view contains a field list and the design grid. The
field list contains the fields for the table you are querying. The table name appears at the
top of the list box, and the fields are listed in the order in which they appear in the table.
You can scroll the field list to see more fields, or you can expand the field list box by drag-
ging its borders to display all the fields and the complete field names.
In the design grid , you include the fields and record selection criteria for the informa-
tion you want to see. Each column in the design grid contains specifications about a field
you will use in the query. You can choose a single field for your query by dragging its
name from the field list to the design grid. Alternatively, you can double-click a field
name to place it in the next available design grid column.
When you are constructing a query, you can see the query results at any time by click-
ing the View button or the Run button on the Query Design toolbar. In response, Access
displays the query datasheet (or recordset), which contains the set of fields and records that
results from answering, or running , the query. The order of the fields in the query datasheet
is the same as the order of the fields in the design grid. Although the query datasheet looks
just like a table datasheet and appears in Datasheet view, a query datasheet is temporary,
and its contents are based on the criteria you establish in the design grid. In contrast, a
table datasheet shows the permanent data in a table. However, you can update data while
viewing a query datasheet, just as you can when working in a table datasheet or form.
If the query you are creating includes every field from the specified table, you can use one
of the following three methods to transfer all the fields from the field list to the design grid:
• Click and drag each field individually from the field list to the design grid. Use this
method if you want the fields in your query to appear in an order that is different from
the order in the field list.
• Double-click the asterisk in the field list. Access places the table name followed by a
period and an asterisk (as in “Employer.*”) in the design grid, which signifies that the
order of the fields is the same in the query as it is in the field list. Use this method if you
don’t need to sort the query or specify conditions for the records you want to select. The
advantage of using this method is that you do not need to change the query if you add or
delete fields from the underlying table structure. Such changes are reflected automati-
cally in the query.
• Double-click the field list title bar to highlight all the fields, and then click and drag one
of the highlighted fields to the design grid. Access places each field in a separate column
and arranges the fields in the order in which they appear in the field list. Use this method
when you need to sort your query or include record selection criteria.
Now you’ll create and run Zack’s query to display selected fields from the Employer table.
Creating and Running a Query
The default table datasheet displays all the fields in the table, in the same order as they
appear in the table. In contrast, a query datasheet can display selected fields from a table,
and the order of the fields can be different from that of the table, enabling those viewing
the query results to see only the information they need and in the order they want.