You are on page 1of 15

Creating Simple

Queries
Prayer
01
What is a Query?
Query
 Allows you to work with a specific set of records that meet the
criteria you have specified from a table in the database.

 You use them to view, change and analyze data in different ways.

 When you run a query, the results will appear in the Datasheet
view, shown like table

 Query is a request to perform an action on the data

 Using Queries is like the Find command with complex criteria.


Query Window Elements
This is where you select a field to be part of the query. The drop-down arrow displays
Field the available fields. If you have more than one criteria, go to the next column to select
another field.

Table Indicates the filename of the table you are working on.

Sort This allows you to sort the results of the query.

This is where you will enter the search conditions for the fields you want to search.
Criteria Always use quotation marks “ “ on your typed criteria. You can also use operators to
refine a search.
02
Using Queries with the
Simple Query Wizard
1. On the Create tab, click the Query Wizard

2. On the New Query dialog box, click the Simple Query Wizard and click OK.

3. When the Simple Query Wizard pens, click the down arrow to select the table
or other query from which you want to select fields.

4. Click a field and click the right arrow to move the field to the selected Field list.
You can click the double arrow to move all the fields at once.

5. You can pull as many fields as you want.

6. Click Next.

7. Type the name for the query and click Finish.

8. The query results will now appear in the datasheet.


03
Creating Queries Using the
Query Design View
- The Query Design View will allow you to create a query which has the
full range of capabilities including filtering.
1. On the Create tab, click the Query Design.

2. On the Query Design window, a Show Table dialog box appears.

3. Click the table that you would like to include in the query.

4. Click Add.

5. Repeat the steps if you want to add more tables, then click Close.

6. The upper part of the Query window displays the available tabes and fields. The lower
part is the Query grid that allows you to specify the information needed to create a
query.

7. Drag as many fields as you need into the first empty column in the Query grid.

8. Click View to check the query results in the Datasheet view.

9. The results will appear in the datasheet.

10. Click the Save button and on the Save as dialog box, type the name for your query.

11. Click OK.


To create a query you must give three pieces of information:

1. The fields you want to search

2. The Search Criteria or the item that you are searching for

3. The fields that you want to display with the results


04
Editing the Query
- You can insert, arrange and remove query fields.
To insert a field:
1. On the Create tab, click Query Design.
2. On the Query grid, click at the top of a field’s column to select it.
3. On the Design tab, click Insert Columns.
4. When a new blank column appears, drag the new field into the blank column.

To remove a field:
5. On the Create tab, click Query Design.
6. On the Query grid, click at the top of a field’s column to select it.
7. On the Design tab, click Delete Columns

To move a field:
8. On the Query Design view, click at the top of a field’s column to select it.
9. Drag the bar above the field left or right to remove it.
10. A black line will appear to show where the field is being moved.
Criteria
 These are conditions that will determine which record will be
included.

 The criteria will filter the query results.

 It may be numeric or text.

 It is better to specify a range of values than one specific values.


04
Filtering a Query
1. On the Create tab, click Query Design.

2. On the Criteria row, type the value that you want to filter.

3. If the value is a data, enclose it hash marks: #06/30/12#.

4. If you want to use a text string, enclose it with quotation marks: “NBS*”.

5. If you want to specify a range of values, use greater than >, less than <, greater than or
equal to >=, less than or equal to <=, or equals =.

6. If you want to use ranges that are in between, type Between and add a space or type
And then add a space.

7. You can also use Or and add space and type the net value.

8. Click View to check your work.

You might also like