Upload
kokan-baba
View
212
Download
0
Tags:
Embed Size (px)
DESCRIPTION
globumd
Citation preview
Topic 7
Microsoft Access -‐ Lab
At the end of the session, students should be able to:
• Create tables using a relational database. • Enter, edit and delete data using tables and forms. • Define primary and foreign keys. • Define relationships between tables. • Create Queries. • Generate Reports.
__________________________________________________________________________________
Creating A Database
1. Create a blank database by clicking on the Blank desktop database icon and enter the file name as Accesslab as follows:
2. Create a table by clicking on the Create tab and selecting the table option:
Creating a Table
3. Click on the View icon and select the Design View option to create the structure of the table:
4. You will need to save the table first by naming it as “Travel”.
5. In the design view of table, delete the default primary key field by clicking on the row and pressing the “Del” key on your keyboard. Click “Yes” to confirm.
6. Define the structure of the table by entering the following fields for the table:
7. You can define the Cust ID field as the Primary Key by clicking on the Primary Key Icon. After completing defining the fields, click on the View icon:
8. Select the Database View option to enter the data:
9. Enter the following data:
Creating a Form
10. Creating a form by clicking on the Create tab and selecting the Form Wizard option:
11. Pick the following fields and click the right arrow button to place them on the right:
12. Click the Finish button and you will find the following form ready for you to edit the data in your table:
13. Select the Design view under the View icon to change the heading of the form to “Star Travel Agency”.
14. Enter the name “Star Travel Agency” to the text box on top.
15. Click on the button icon to create navigation buttons by using the Command Button Wizard.
16. Create the following navigation buttons:
17. To create the first button select the relevant button icon and select Go to the First Record for the first button. Click on the Next button below to continue:
18. Select Picture option and click on the Finish button.
19. Repeat the same procedure creating buttons for Go to Last Record, Go to Next Record and Go To Previous Record.
20. Click on the View icon to test out the form.
Creating a Report
21. Click on the Create tab and select the Report Wizard option.
22. Select the following fields and place it to the right panel by clicking on the right arrow button as follows:
23. Click on the View icon and Form View option to view the form.
Creating a Query
24. Clcik on the Creat tab and select the Query Design option.
25. Select the Travel table for your Query.
26. To select the fields for your Query, click on each field on top and place it in the columns below.
27. Click on the View icon and the Datasheet View to view the query.
28. Create another new query by selecting the Cust ID, Cust Name, Destination and Price fields and create a filter for your query by entering the word “Taipei” as your criteria under the Destination column.
29. Click on the View icon and the Datasheet View to view the query.
30. Create a new query to view data records with Departure Date after 30/12/2014. Select all the fields and enter “<#30/12/2014#” for your criteria under the Departure Date column as follows:
31. Click on the View Icon and Datasheet View to view your result.
Create a Query linking multiple tables
32. Create a new Hotel table with following fields to capture the Hotel reservation for the customers:
33. Enter the following data:
34. Create the following a new query and select both tables. Link the Cust ID for both tables by clicking on the Cust ID field on the Travel table and drag it to the Cust ID field on the Hotel table. Select the Cust ID, Cust Name and Price fields from the travel table and City, Check-‐in Date and Check-‐out Date from the Hotel table to the columns below.
35. Click on the View icon and Datasheet View option to view your query selection.