Building a Query from Scratch



After you've opened the database on which you want to base a query, click the Queries button in the Objects bar.


Double-click the Create query in Design view option.


The Show Table dialog box opens, displaying a list of the tables contained in the open database. Click the table you want to use for your query.


Click the Add button to add a list of the fields in the selected table to the Design window.


In addition to using a wizard to select the fields for a query, you can also build a query from scratch using the Design view to add the fields. As with the wizard, you still need to enter the criteria for the query after you build it from scratch; you'll learn how later in this part.


Pulling from Multiple Tables

If you want, you can create a query that pulls data from multiple tables; simply select the tables from the Show Table dialog box. For information on building a query with fields from multiple tables, consult Access's online help.



Click the Close button in the Show Table dialog box to close it.


Click in the Field box in the lower half of the Query Design window; a down arrow appears.


Click the down arrow in the Field box and choose the first field that you want to add to the query from the list that appears.


The field is added. To add another field, click the box immediately to the right of the field you just added. A down arrow appears; click it and choose the field you want to add.


Dragging Fields

If you prefer, you can drag a field from the field list to the Field column in the design grid.



Continue adding fields until the query contains all the fields you need.


You now have the structure for your query and are ready to save and name it. To begin, open the File menu and choose Save.


The Save As dialog box opens. Type a name for the query in the Query Name field and click OK.


The query is saved. When you close the query, it will be listed in the database window under the name you typed in step 10.


Saving the Query

If you prefer, you can click the Save button on the toolbar to open the Save As dialog box. If you try to close the query without saving first, you will be prompted to save; click Yes to save the query.