Presentation is loading. Please wait.

Presentation is loading. Please wait.

Day 17: MICROSOFT ACCESS – CHAPTER 2 Contd

Similar presentations


Presentation on theme: "Day 17: MICROSOFT ACCESS – CHAPTER 2 Contd"— Presentation transcript:

1 Akhila Kondai akhila.kondai@mail.wvu.edu October 16, 2013
Day 17: MICROSOFT ACCESS – CHAPTER 2 Contd. MICROSOFT ACCESS – CHAPTER 3 Akhila Kondai October 16, 2013

2 The Rock & Roll Hall of Fame Database Example
Premise: We want to create a database to keep track of Bands & Members One Band could have Many Members For the members, we also want to track their country of origin. There could be one country for many members. 3 Tables, 2 relationships… 11/16/2018

3 Table Relational Structure
Members Bands 1 Countries 1 11/16/2018

4 AutoNumber Primary Key Example
Create a New Blank Database called Music Switch to Design View Create Bands table with a field BandNum of type AutoNumber (Primary Key) Create field called BandName of type Text Flip to Datasheet view and enter these records: 1, Beatles 2, Van Halen Close the table 11/16/2018

5 AutoNumber Example Continued
Create another table: Create ribbon > Table Call it Members and enter these fields: Member AutoNumber (Primary Key) FirstName Text LastName Text BandNum Number (will relate to “Band” Table later) * NOTE: Autonumber from Band Table is compatible with Number type in this table. DO NOT USE AUTONUMBER on both sides of the common field You may land up in trouble ! 11/16/2018

6 Second Table from Example
Flip to Datasheet view and Save the table Enter these records: Member First Name Last Name BandNumber 1 Paul McCartney 2 John Lennon 3 George Harrison 4 Ringo Star 11/16/2018

7 Second Table Completion
Enter these too… * Close the table and we will come back to this later… Member FirstName LastName BandNum 5 David Lee Roth 2 6 Edward VanHalen 7 Alex 8 Michael Anthony 11/16/2018

8 Lookup TYPE FIELDS They help in creating a drop down menu when entering field values while in datasheet view to select predefined items as opposed to having to type them. Two types of lookup fields: Lookup references uses field values in another table Lookup references items you manually enter in advance in the same table 11/16/2018

9 Lookup from Other Table Example
Create the third table for our database called Countries Make these fields: ID AutoNumber (Primary Key) Country Text 11/16/2018

10 Lookup from Other Table Example
Flip to Datasheet view Create the following Records: 1, England 2, America Close the table 11/16/2018

11 Lookup from Other Table Example
Return to the “Members” table in Design View Add a 5th field called Origin of Data type Lookup Wizard Use I want the lookup column to look up values in a table or query > Next Select Table: Countries > Next 11/16/2018

12 Lookup from Other Table Example
Add the Country field to Selected fields Next ->Next ->Finish… Save Return to Datasheet View in “Members” Click in the Origin file to assign these: Assign England to Beatles members Assign America for Van Helen members 11/16/2018

13 Same Table Lookup Example
Again in the Members table of our example, return to Design View Create a new field called Instrument of type Lookup Wizard… This time select “I will type the values I want.” Enter the following: Vocals, Drums, Guitar, Bass Press Finish, and return to Datasheet view (and save) 11/16/2018

14 “Yes/No” Field Type Example
Add a field called Living Make it of Type Yes/No Save the table and mark all records except John Lennon as Living members * We will come back to this 11/16/2018

15 Create a Relationship Close the table
Database Tools -> Relationships Note that lookup wizard created one already! Right click, Show Table, add Bands. Drag [Bands/BandNum] to [Members/BandNum] Enforce referential Integrity Create, and save. 11/16/2018

16 Query Example Use the relationships to seamlessly query between fields in the three tables to show the names of the artists, their bands and their countries Create query in design view Add all tables (note the relationships showing) 11/16/2018

17 Query Example Add these fields: Run the Query !
Bands: BandName Members: FirstName, LastName, Instruments, Living Countries: Country Run the Query ! Band/Instrument/Country names only typed in once! Close and Save Query as BandTrivia 11/16/2018

18 Forms & Subforms You can create a form with a subform by including fields from each of two tables that have an established relationship formed When the relationship between the tables is a one-to-many relationship, the main form will consist of data from the primary table and the subform will consist of data from the related table 11/16/2018

19 Form with Subform Example
Create form by using wizard Create ribbon -> Forms section -> Form Wizard Click the “Tables/Queries” drop down and select the Bands table, add BandName 11/16/2018

20 Form/Subform Critical Step!
Switch to appropriate table to add more fields and create Subform! Click the “Tables/Queries” drop down and switch to the Members Table Add: FirstName, LastName, Origin, Instruments, and Living Click Next, and verify “Form with subform(s)” is shown at the bottom 11/16/2018

21 Form with Subform Example
Next > Select Tabular layout Click Finish Use the bottom navigation controls to show the band in the top and the members in the bottom! 11/16/2018

22 Form with Subform Sample
Main Form Sub- Form Main Form Controls Subform Controls 11/16/2018 Access Chapter 2_2

23 ADDING RECORDS USING FORMS…
Use the form to add records to 2 tables at once! Click the New Record button at the bottom Type Def Leppard for the band name Enter Joe Elliot, England, Vocals, Living Close the form and look in the Bands and Members tables ! 11/16/2018 Access Chapter 2_2

24 Reports Let us put things into a visually professional format suitable for printing Creation can be somewhat like doing Forms with Subforms… 11/16/2018

25 Reports Create ribbon > Reports Group > Report Wizard
Add these fields: [Bands] Band Name [Members] FirstName,LastName, Instrument, Living [Countries] Country 11/16/2018

26 Reports Click Next 3 times
Sort Ascending by LastName and then FirstName Click Next 2 times Click “Finish” To Change any of the column widths in Report Right Click and Select Layout View Drag the fields to resize!! 11/16/2018

27 Reminder Lesson C in MyITLab is due on 10/21/2013 (Monday) by 11:59 P.M.

28 Questions ?


Download ppt "Day 17: MICROSOFT ACCESS – CHAPTER 2 Contd"

Similar presentations


Ads by Google