You are on page 1of 9

Step by Step Access Exercise with Notes

NB: To create a new Access DATABASE (in order to import the excel files; or create tables etc), perform the
following:

1. Start Access (Start / Programs / Microsoft Office / Microsoft Access)

a. Access 2003: Then on the File menu, select Open, and then on the right hand side, select Blank
Database
b. Access 2007: Click the Office Button and Select New

2. You can type TUTORIAL and click Create. (Your file will automatically be saved in the Documents folder
but you can also choose to save the file on you flash stick or on the desktop if you wish)

3. You should see one of the following screens. Note the name of the database is called Tutorial. There are no
tables created as yet!

Screen for Access 2003

Startup Screen for Access 2007 to select ‘Blank’ After creating the Database in Access 2007

4. Now, using the handout called ‘Importing Excel files to Access’, follow the instructions to import the
Product and Supplier worksheets to Access. They will become tables in the Tutorial database.

1
Creating Relationships

5. BEFORE you create any queries or reports, you should create a relationship among your tables. To do so,
select Relationship from the (Database) Tools menu.

6. You should see a grey area (Access 2003) or a blue area (Access 2007). The show table dialog box like the
one below should be visible. In Access 2007 you may need to click the SHOW TABLE icon.

7. With Product selected, click ADD, then select the Supplier table and also click ADD. Then click Close. If
this window does not appear, (Access 2003) right-click in the gray area and select the SHOW WINDOW or
SHOW TABLE option. In Access 2007 you may need to click the SHOW TABLE icon as illustrated above.

This dialog box is shown for you to add the Product and Supplier tables.

8. Now, we need to link the tables together. Look at the fields in each table. You should note that there is a
common field SupplierID in both tables. This is the field we will use. Select this field in one table and while
holding down you left mouse button, DRAG it to the next SupplierID in the next table, don’t worry if you
see a ‘no entry’  sign appear as you drag! Once you are reached the next SupplierID, release the mouse
button and another window should appear:

9. In this window, you need to ‘Enforce Referential Integrity’. Then click Create. This window tells you that
there is One Supplier ‘supplying Many Products!

2
10. Notice that a line is drawn from Supplier (with a 1 next to it) to Product (with an infinity sign next to it),
even though we dragged from Product to Supplier. Access determined the type of relationship for us (1:M)

11. Close this window (you will be prompted to save the relationship). Now, we are ready to create our queries!

QUERIES

12. To create a query:


a. Access 2003: Click on Queries on the left pane, and choose ‘Create Query in Design View’. Add
both tables, and close the Show Table window.
b. Access 2007: Click Create, from the ribbon, and choose Query Design (near to the right hand
side of the ribbon)

13. The first question in the tutorial sheet is: List the Product Name, Supplier and Units in
Stock of all the items in your product table.
14. Find these fields by perusing the tables. Note that the Supplier is the Company Name field. For each one
double click on the field, and it will show in the lower pane as shown below:

3
15. Then click on the icon in the top LEFT HAND CORNER icon indicated above to view your result.
Note that there are 77 records in the table. Also note that the icon has changed, but you still click on it to

return to design view if you wish.

16. Close the query (click on the X) and you will be prompted to save it as Query 1. You can always give it an
appropriate name. If you happen to close the database, don’t worry, your work has been saved. Start
Access again and go back to the query.

17. Repeat part 12 above, to answer the next query. What are the products that cost more
than a hundred dollars? You should note below, that to determine those that cost more than $100,
place your cursor in the criteria row, in the UnitPrice column, and then type >100. Do not include dollar
signs. Use the view icon or to see the result or design of the query.

Design view of the query (Data View) Result of the query

4
18. Repeat part 12 above. What are the category 6 items that are supplied by Ma
Maison? (The fields here are CategoryID, and Company Name. You can include the Product Name if you
wish)

19. Repeat part 12 above. What is the average price of the products, the maximum
units in stock and the minimum reorder level of the products? Here the fields
are UnitPrice, UnitsInStock and ReorderLevel.

20. In order to perform calculations such as average, count, max, min and so on, we use the Totals icon .
Click once and you should see another row appear in the lower half of your query, and the labels ‘Group
By’ in each cell.

5
21. Now, in the UnitPrice column, click on the arrow next to the Group By, and select Avg. in the
UnitsInStock column, select max. In the ReorderLevel column select min.

22. When you view your result, it should be similar to the one below.

6
23. Repeat part 12 above. What is the average unit price of Category 1 or 2
products? Notice, how the numbers 1 and 2 have been entered to signify category 1 or 2 products.
BUT, we are not finished!

We need to activate the Totals to find the average unit price. Then we are finding the average unit
price of these categories, so we leave the Group By as is in the Category ID field, but change it to
average in the Unit Price field.

Design View and Data view of this query. Try this query again but with category 1 or 6!

24. Repeat part 12 above. What is the stock value of each item the owner is
currently carrying?

25. Note how the two fields UnitPrice and UnitsInStock are used, but we now CREATE a new field call Stock
Value with the calculation as
Stock Value: [UnitPrice]*[UnitsInStock]

26. The fields are enclosed in square brackets. Make sure that you type them EXACTLY as is, no spaces and
capital letters for the Unit and Price and Units and In and Stock!

7
27. Note that the Stock Value, does not look like currency, so we need to format it. Go back to (Design
View), and (Access 2003) right click in the Stock value column, then choose Properties; (Access 2007)
select Property Sheet near the top right hand side of the screen. As a new window appears, click next to the
format row and select currency. Close that window (Click on the X), and then view your result.

Save that query as Stock.

8
28. What is the stock value? Create a query in Design view. However this time, in the Show
Table box, Choose QUERIES, instead of TABLES, and add the Stock query, the Close.

Choose
Queries
not
Tables
this time

In Design view, select the Stock Value field only. Then activate the Totals row, but clicking the
Total icon . Change the Group By to Sum

Try Formatting it for currency.

There is so much help on the Internet that you can ‘google’ it for videos, examples and explanations.

Here is a website that may also be useful to you:

http://www.gcflearnfree.org/access

G. Gay
Last Modified 2014

You might also like