Using the Simple Query Wizard

Team-Fly    

 
10 Minute Guide to Microsoft Access 2002
By Joe Habraken
Table of Contents
Lesson 17.  Creating a Simple Query

Using the Simple Query Wizard

The easiest way to create a query is with the Simple Query Wizard, which enables you to select the table fields you want to include in the query. A simple query is useful when you want to weed out extraneous fields but still want to see every record in the database table. The Simple Query Wizard helps you create a select query.

Plain English

Select Query The select query is used to select certain data from a table or tables. It not only filters the data, but it can also sort the data. It can even perform simple calculations on the results (such as counting and averaging).


To create a select query with the Simple Query Wizard, follow these steps:

  1. In the Access window, open the database with which you want to work and select the Queries icon in the database window.

  2. Double-click Create Query by Using Wizard. The first dialog box of the Simple Query Wizard appears (see Figure 17.1).

  3. Choose the table from which you want to select fields from the Tables/Queries drop-down list.

  4. Click a field name in the Available Fields list; then click the Add ( > ) button to move the field name to the Selected Fields list. Add fields as needed, or move them all at once with the Add All ( >> ) button.

  5. (Optional) Select another table or query from the Tables/ Queries list and add some of its fields to the Selected Fields list (this enables you to pull data from more than one table into the query). When you have finished adding fields, click Next .

Figure 17.1. The Simple Query Wizard first asks what fields you want to include in the query.

Caution

Relationships Required If you're going to use two or more tables in your query, they must be joined by a relationship. See Lesson 11, "Creating Relationships Between Tables," for more information.


  1. On the next screen, enter a title for the query. Then, click Finish to view the query results. Figure 17.2 shows the results of a simple query.

Figure 17.2. Queries created using the Simple Query Wizard list the data from the fields you selected.

The problem with queries created using the Simple Query Wizard is that you aren't supplied with the option of setting sort parameters for the records or the capability to filter them by particular criteria. Simple queries just allow you to select the fields. For this query to provide a little more manipulation of the table data, you would have to edit this Query Design view, which is discussed in the next lesson. Building queries from scratch provides you with a lot more control over how the data is filtered, sorted, and summarized.

Saving a Query

When you create a query, Access saves it automatically. You don't need to do anything special to save it. When you are finished viewing the results of the query, click its Close ( X ) button. The new query is then listed in the Query list that the database window provides.

Rerunning a Query

At any time, you can rerun your query. If the data has changed in the table fields that you included in a query, rerunning the query provides you with an updated set of results.

To rerun a query, follow these steps:

  1. Open the database containing the query.

  2. Select the Queries icon in the database window.

  3. In the Query list, double-click the query you want to run, or click it once and then click the Open button.

Tip

Queries Look Like Tables Queries can be manipulated in the Datasheet view just like a table. You can use the Sort and Filter features on a query, or you can delete records from the query.



Team-Fly    
Top
 


10 Minute Guide to Microsoft Access 2002
10 Minute Guide to Microsoft Access 2002
ISBN: 0789726319
EAN: 2147483647
Year: 2000
Pages: 160
Authors: Joe Habraken

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net