A query's purpose is to allow you to filter out specific
records for display. Suppose you have created a database of all the students
in a school. You want to display only the students who participate in basketball
and football. That information is under the field name "Sports". You
can generate a query form that will only show the names of the students who play
that specific sport. You may choose any field for display. If you
only want the students' first name, last name, home room, and sport, you can display
only those fields without displaying fields like address, parent's fame, etc.
This is how you do it:
When you have finished entering, editing, and sorting
your data, save the table and close it down by clicking File on the
menu bar. Then click Close.
You should see a dialog box with a column on the
left that has the words: Objects, table, query, form, reports, pages,
macros, modules, groups, and favorites. Click on query and then
new.
A box should pop up. Click on design view
and OK.
The next screen will have two boxes.
The box in front should say "Show table". You will have three tabs
to choose from (tables, queries, both). Since you have only created
one table so far, that is all you can choose right now. Be sure the
table tab is selected. Click on the name of your table and choose
add. For this example, let us suppose the name of the
table is "student stats". Click on close to get to the second box
on this same screen.
Now a palette list of all the fields
from your table should be in the top half of that box.
There are several fields at the
bottom half for you to enter information. To the left of
the fields at the bottom, there is a list that says: field, table,
sort, show, and criteria. Click in the area beside the word "field".
A grey and black drop down arrow
should appear. Click on that arrow and choose the field that you
want to appear in your query. In this case, let us say the field
we want to show is "extra curricular activities".
Click in the area beside the word
"table". Choose the name of the table you want to pull from. (this
is just in case you had more than one table)
Click in the area beside the word
"sort". Decide how you want your information to appear. (ascending
or descending) You may chose not to sort at all. That is fine.
Click in the area beside the word
"criteria". We do not want to see the students that play tennis, golf,
hockey, etc. We only want three specific sports. You have to
specify which athletes you want to see or the query will show all the athletes
from every sport.
In the criteria section you will type
basketball or football exactly as it appears in your database. In
the next column to the right, do this process again, except choose the field
"student name".
Do the process again to choose "home
room". Since you are not looking only for students with a certain
name or homeroom, you do not need to specify a criteria for these fields.
(unless you really want only those students named John Smith from Mrs. Taylor's
home room that play basketball or football) That kind of query will
yield very little if anything at all.
Remember we said that we only want
some of the information from the table to show up on your query so you
many chose which ever fields you want to appear.
When you are finished selecting
fields, click on the view from the menu bar and then choose data
sheet. You should be able to see your query now
with the filtered information.
You can print your query by clicking
on file in your menu bar. Click print. You
may want to print your query in landscape. In that case go to
file, page setup, and choose landscape and then
print.