· web view(genre is pronounced “jahn-rah” and it means the category that would describe the...

15
Database Applications Microsoft Access Lesson 2: Creating a Database You will create a database that organizes your top 20 favorite songs. Creating a Database: 1. Open Microsoft Access. 2. In the New Blank Database section, click the Blank Database template. 3. In the Blank Database pane, click the Browse button. The File New Database dialog box will appear. 4. Go to the Microsoft Access folder in your student drive/Access folder and save this database as Music Playlist_XX (where XX is your initials). 1

Upload: trankien

Post on 16-Feb-2019

213 views

Category:

Documents


0 download

TRANSCRIPT

Database ApplicationsMicrosoft Access Lesson 2: Creating a Database

You will create a database that organizes your top 20 favorite songs.

Creating a Database:1. Open Microsoft Access.

2. In the New Blank Database section, click the Blank Database template.

3. In the Blank Database pane, click the Browse button. The File New Database dialog box will appear.

4. Go to the Microsoft Access folder in your student drive/Access folder and save this database as Music Playlist_XX (where XX is your initials).

1

5. Click to return to the Blank Database pane in Access.

6. Click . Access creates the new database and automatically creates the first table in the database (named Table1) for you.

7. To save the table as a new name, click the Save button on the Quick Access toolbar. The Save As dialog box will appear.

8. Enter the name Songs and click .

Now that you have saved the first table in the database, you must add some fields to the table. Access automatically includes the ID field for you. It is a primary key which means that it is a field that will contain a unique value for each record in the table.

Adding Fields to a Database Table:9. Double click the Add New Field field selector in the table. Type the word Song in the field selector and press the

Tab key. The insertion point will move to the next field selector in the table.

2

10. Type the word Singer (or Artist) and press the Tab key.

11. In the next field selector, type the word Album and press the Tab key.

12. In the next field selector, type the word Time and press the Tab key.

13. In the next field selector, type the word Genre and press the Tab key. (Genre is pronounced “jahn-rah” and it means the category that would describe the music – for example: Classic Rock, Country, Hip Hop, Rap, etc.)

14. In the next field selector, type the word Rating and press the Tab key twice.

Your cursor should go to the field in the first record of the table and the word (New) should be highlighted.

Before you start adding data in the fields, you will go into Design View to set up the Data Types for each field.

3

Setting Database Table Design Properties:

15. With your mouse, right click the Songs table tab and select Design View.

Notice that the data type for the ID field is AutoNumber so that Access will automatically number your records for you.

The Song, Singer, and Album fields should contain Text type data so you will leave those settings as they are.

16. Click in the Description box of the Song field and type Song Title.

17. Click in the Description box of the Singer field and type Singer’s Name.

18. Click in the Description box of the Album field and type Name of Album.

19. Click in the Data Type section for the Time field.

20. Click the down arrow that appears in the box and select the Date/Time option.

21. Click in the Description box and type Length of Song in Minutes and Seconds.

22. In the Field Properties section at the bottom of the screen, click in the Format box.

23. Click the down arrow that appears in the box and select the Short Time option.

24. Click in the Description box of the Genre field and type Style of Music.

25. In the Field Properties section at the bottom of the screen, click in the Default box.

26. Figure out what the most common genre of music is on your Music Playlist. Type it in this box. For example type Rock. Press the Enter key on your keyboard.

4

27. Click in the Data Type section for the Rating field.

28. Click the down arrow that appears in the box and select the Number option.

29. Click in the Description box of the Rating field and type Song Rating on a Scale of 1 to 10.

30. In the Field Properties section at the bottom of the screen, click in the Field Size box (where it currently says Long Integer).

31. Click the down arrow that appears in the box and select the Integer option.

You will now return to the Datasheet view for the database table.

32. With your mouse, right click the Songs table tab and select Datasheet View. The following dialog box will appear to ask you to save the table.

33. Click .

Adding Records in the Database Table:You will now start adding data to the table. You will let Access give each record an ID number.

34. Press the Tab key to move to the next field in the record.

As soon as you start typing, Access will automatically insert a number in the ID field for you. This is the AutoNumber function.

35. In the Song field, type the name of the first song on your Music Playlist.

36. Press the Tab key to move to the next field in the record.

37. In the Singer field, type the name of the singer who sings this song.

38. Press the Tab key to move to the next field in the record.

39. In the Album field, type the name of the album that this song is included on. If you don’t know the name of the album, you can Google it online.

40. Press the Tab key to move to the next field in the record.

5

41. Type in the length of the song in minutes and seconds in the format MM:SS.

42. Press the Tab key to move to the next field in the record.

43. If this song is the default genre that you set up in the design properties, you don’t have to type anything.

If the song style differs from the default genre, type in the style for this song such as Classic Rock, Country, Hip Hop, Rap…

44. Press the Tab key to move to the next field in the record.

45. Type in a numeric value from 1 – 10 to rate this song.

46. Press the Tab key to go to the next record.

47. Continue adding information about all of the songs on your Music Playlist. (For the ID field, continue letting Access autonumber the records for you.) Add 10 songs to your table.

Creating a Database Form:A database form allows you to view and enter records in the database without having to look at the entire database table.

48. Click the Create tab above the ribbon.

49. In the Forms group of the ribbon, click on the button and select Form Wizard.

The Form Wizard dialog box will appear.

50. Click on the ID field in the Available Fields list.

51. Click the button to move it to the Selected Fields box.

6

52. Add the Song, Singer, Album, Time, Genre, and Rating fields to the Selected Fields box.

53. Click . The Form Wizard will then ask you to select the layout for the form.

54. Keep the layout as the Columnar layout.

55. Click . The Form Wizard will then ask you to name the form.

7

56. At the top of the dialog box, change the name of the form from Songs to Song Form.

Make sure the option to open the form to view or enter information is selected.

57. Click . The new database form that you created will open.

The first record that you entered in the table will be displayed in this form view.

You will now enter some new songs into the database using the form view.

58. At the bottom of the form view, click the New (blank) record button.

The new record will appear. It will be completely blank except for the Genre field that will contain the default value that you entered in the design properties.

There should be a blinking cursor to the right of the Song field.

8

59. Type the name of the next song on your Music Playlist in this field. (Make sure it’s not one of the ones that you entered in table view.)

60. Press the Tab key on the keyboard to go to the next field.

61. Type the name of the singer who sings the song.

62. Press the Tab key on the keyboard to go to the next field.

63. If this song is the default genre that you set up in the design properties, you don’t have to type anything.

If the song style differs from the default genre, type in the style for this song such as Classic Rock, Country, Hip Hop, Rap…

64. Press the Tab key on the keyboard to go to the next field.

65. Type a number for the rating you give this song.

66. At the bottom of the form view, click the New (blank) record button.

67. Add the data for another song on your Music Playlist.

68. Continue adding new records in form view until you have added 10 more song records in the database. (You now should have at least 20 total records in this database.)

69. With your mouse, right click the Song Form tab above the form view and select Close.

You should now see the table in datasheet view. Notice that you can’t see the new records that you added in form view. You will have to refresh the table to see them.

70. Click the Refresh All button on the ribbon. The records for all the songs you have entered will appear in the database table.

9

71. Adjust the field widths (columns) and/or the record heights (rows) so that all of the information in the individual fields can be seen.

Creating a Report:72. In the Navigation Pane, click on the Songs Table.

73. Click on the Create tab above the ribbon.

74. In the Reports group on the ribbon, click the Report Wizard button. The Report Wizard dialog box will appear.

10

75. Click on the Song field in the Available Fields list. Click the button to move it to the Selected Fields box.

76. Add the Singer, Album, and Rating fields to the Selected Fields list.

77. Click . The next step in the Report Wizard allows you to group your records. You will group by Rating. This will group all of the songs in the database by the Rating value that you assigned to each song.

78. Click on the Rating field and click the button to add this option to the report.

79. Click . The next step in the Report Wizard allows you to sort your records inside the groups. You will sort by Song. This will alphabetize the songs inside the rating groups by the song title.

80. Click on the down arrow in the first box and select the Song field.

11

81. Click . The next step in the Report Wizard allows you to specify the layout of the report.

82. Select the Columnar layout.

83. Click . The next step in the Report Wizard allows you to name the report.

84. At the top of the dialog box, change the name of the report to Song Report.

85. Click . The report will appear in report view in Access.

12

86. Save your work.

87. Show your work to your teacher.

88. Exit Access.

13