Вы находитесь на странице: 1из 39

Develop a Database Project

1. Click Start button, then click Programs. Click Microsoft Office and select Microsoft Access 2000/2003

2.

Click File and then New.

3.

A File New Database window will pop out. Then type PERSONAL PHONEBOOK in the File Name field and click the Create button.

4.

Click at the Tables tab, then select Create table in Design view.

5.

Key in the field names for the table FRIEND_INFO.

Field Names

6.

FriendID field will be set as a primary key. Click primary key icon. The key icon will appear next to the field, FriendID.

PRIMARY KEY FriendID

7.

Click File and select Save As, then name your table FRIEND_INFO and click OK button.

8. To create the second table, PHONE_NUM, follow steps 4 and 5.

9.

Click File and select Save As, then name your table PHONE_NUM and click OK button.

10. You will be prompted to create a primary key. Click No button. FriendID will become a foreign key since it has been declared as the primary key in FRIEND_INFO table.

11. Click File and then Exit to end this activity.

12. Click Tools from the Menu bar and select Relationships

13. Click Show Table icon . From the list displayed, Select the FRIEND_INFO table. Click Add button.

14. Select PHONE_NUM table and click Add button. Then click Close button.

15. Click Relationships and then choose Edit Relationships. Next select FRIEND_INFO table. Tick Enforce Referential Integrity then click Create button.

16. relationship between FRIEND_INFO and PHONE_NUM (Join type: One-to-Many)

Click File and then Close

Enter data into tables


Click the Tables tab and double click FRIEND_INFO table

Fill all the data given in Figure 10 into the FRIEND_INFO table. After entering all the data, click File and then Close.

Click the Tables tab and double click PHONE_NUM table.

Next, fill all the data given in Figure 12 into the PHONE_NUM table. After entering all the data, click File and then Close.

Click File and then Exit to end this activity.

Click at the Forms tab then select Create form by using wizard. The following Form Wizard screen will appear. Then choose FRIEND_INFO table and move all the fields in the Available Fields section into the Selected Fields section by using this icon . Click Next.

Choose any layout given and then click Next.

Choose any style given and click Next.

Type PERSONAL PHONEBOOK for your form title. Then click Finish.

Figure 8 as shown below will appear.

Creating query
Click the Queries tab. Select Create query by using wizard.

Choose FRIEND_INFO table, move all fields in the Available Fields section by using this icon into the Selected Fields section. Then click Next.

Choose PHONE_NUM table, then move Phone_Number field in the Available Fields section into the Selected Fields section using this icon. Click Next.

Type MY PHONEBOOK for your query title. Then click Finish.

Data in query as shown in Figure 13 will appear.

Generate report
Click the Reports tab. Choose Create report by using wizard.

Choose Query: MY PHONEBOOK and move all fields in the Available Fields into Selected Fields section using this icon . Click Next.

Query: MY PHONEBOOK

Choose which view you want for your data. Click Next.

You will be prompted whether to group your data. Click Next.

You will be asked how you want data to be displayed in the report. Click Next.

Choose a layout for your report then click Next

Choose any style for your report then click Next.

Type PHONEBOOK for your report title. Then click Finish.

Data is displayed