Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Querying the Database in Access 2007

Important

To record enough information so that you can see the power of Access database does enter 24 or more records now.  You may use either Form View or Datasheet View.

This is what a database is designed for: finding specific information about some of the data in the table(s) very quickly.  A Query is a search for general or specific data in a field or fields in your database (e.g. the first and last names and birth dates of all employees, just the Jones’s, the people from CA, salaries > $10,000, etc.).  In order to do this, we need to click on the fields we want to query.  So, let’s start by finding just Last Names in our table.

If you are not in the Database: PERSON Screen which shows the Tables, Queries, etc., go there by following the instructions on Pages 21-24 .

If you have the Personnel Datasheet or Personnel Form open (to add data), close them before you begin your queries.  The Access program sometimes becomes logically confused when you try to do queries when it “thinks” you also want to add data.  You may see “error” messages if you leave the Form or Datasheet open.

You can RIGHT click on the Datasheet and Form Tabs and then select Close – if you have them open.  Your Access screen should look similar to the image below.

Click the Create Tab at the top of the Access screen (left arrow above).  Then move your cursor over the Query Design Button in the Create Tab/Ribbon (right arrow above).

When you move your cursor over Query Design in the Other Group you will see an image similar to the one on the right.

Click the Query Design button.

 

Two new windows will appear: Query 1: Tab and Show Table.  You will first have to select the table(s) you desire to query.  The Show Table screen should look like the one below.

The Show Table window will disappear, and the Query 1: Query window, will appear.

Click-on the expansion square in the upper right corner

to enlarge the Query 1: Select Query window.

Your screen should now look similar to the one below

Notice, in the upper half of the window, a small box on the left indicates: Personnel.  At the top is an asterisk ( * ) and below, in an elevator box, are the fields from the Personnel Table (you can move up-and-down the list as you desire).

What we need to do next is place the Fields we want to query in the lower area of the screen.  Notice the lower area on the left border.  The first row indicates Field:, followed by Table,

Sort:, Show:, Criteria:, and or:.

In the lower half of the screen click-in the first cell to the right of Field:. We’ll start with a query on Last Name, State, Favorite Number and Salary.  Now click-on the down arrow and then click-on Last Name.  Notice how Last Name now appears to the right of Field: and a       (check) is seen in the Show: cell (The    means that you will see Last Names in your query.).  Notice, also, to the right of Table:, that Personnel (the Table from which we queried) is showing.

Your query screen should now look like the one on the right.

Now move to the next Field cell on the right and, using the down arrow click-on State.  In the next two fields to the right, insert Favorite Number and Salary.  Your Query1: Select Query screen should look like this:

Now, look in the Button Bar at the top left of the screen.  In the middle of the bar you will see an exclamation mark (  !  ) like the one on the right.  If you move the cursor over it, the help text box will indicate “Run.”  Click-on the (  !  ).  This click executes your query.

Your query screen should look similar to the one on the left.

Notice, the screen ONLY shows the four fields that you queried.

You can add or remove fields, as you desire.  To do this we need to return to the Design View where we created this query.  To return to Design View click-on the small button in the upper left corner of the screen that has the blue triangle, pencil, and ruler (like the one on the right).  Then, simply click-in the Field area and select a new field and it will replace the old one.  Or, click-on the field you want to remove and tap the Delete key.  Sometimes you may have a lot of fields and it will be too large for a single sheet of paper.

To see how your query will look, if you print it, we’ll show you how to open a Print Preview

First, click the Microsoft Office Button on the upper left of your Access Screen.  Then move your cursor over the Print selection.  A Preview and print the view area will appear on the right.  Move your cursor over Print Preview and click on this selection.

While you’re in the Print Preview you’ll see a little magnifying glass that you can move over your query.  If you click the left mouse button once the magnifying glass will “zoom” in and enlarge the view.  If you click the left mouse button again it will zoom out.

To return to your query, click-on the Close Print Preview button on the right side of  the Print Preview Tab/Ribbon.  This will take you back to the Normal View of your query.


Filed under: Computer Tagged: #Computer Tips, #graphics, Computer, database, Installation, postaday, postaweek, Query, software, Technology, Tips, windows


This post first appeared on Computinfo, please read the originial post: here

Share the post

Querying the Database in Access 2007

×

Subscribe to Computinfo

Get updates delivered right to your inbox!

Thank you for your subscription

×