Creating a Query in Design View
If you're completely new to queries, this section is for you. Here we create a simple select query so you can see what, exactly, a query does.
Just follow these steps to create a simple query:
- Display the Create tab on the Ribbon.
- Click the Query Design button in the Other group.
Access displays Design view and the Show Table dialog box.
- In the Show Table dialog box, select the table that contains the fields you want to display in the query datasheet, and then click the dialog box's Add button.
- Click the Close button in the Show Table dialog box.
Now Design view displays the table you selected in its top pane and the empty design grid in its bottom pane.
You can close the Query Property sheet - you don't need it right now. Redisplay it at any time by clicking Property Sheet in the Show/Hide group of the Design tab on the Ribbon.
- Double-click a field name in the top pane to display that field name in the bottom pane - the design grid. Repeat to include any additional fields.
You can drag a field name to the design grid or double-click a field name to move it to the grid. You can also use the drop-down Field and Table lists in the design grid to select the fields that you want to use. To select multiple field names in the Field list, use the standard Ctrl+click or Shift+click selection techniques, and then drag all selected field names to the design grid.
- Click the View button to see the datasheet with the data selected by your query.
Our datasheet, shows the three fields we put in the design grid.
If you want to save the query, click the Save button on the toolbar. Give the query a name that indicates the data it selects. Remember that the next time you open the query in Datasheet view, you see updated data - if any records have been added, deleted, or modified, the query reflects that. You may choose not to save the query, if you won't need it again. Just close it and click the No button when Access asks whether you want to save it.
Now that you have the hang of what a query is, you're probably ready for more - getting summary data out of a query, sorting the results, limiting results with criteria, and so on.
In this tutorial:
- Creating Select Queries
- Types of Queries
- Creating a Query in Design View
- Creating a Query with the Simple Query Wizard
- Viewing Your Query
- Tips for Creating a Query
- Editing a Query
- Sorting a query
- Changing the format of a query field
- Limiting Records with Criteria Expressions
- Using dates, times, text, and values in criteria
- Using multiple criteria
- Using lookup fields in criteria
- Working with Multiple Related Tables
- Working with Query Datasheets
- Saving Queries