Click here to load reader

Access Manual 4 By Elham S.Khorasani Ismail Guneydas Dhawala Kovuri

Embed Size (px)

Citation preview

  • Slide 1

Access Manual 4 By Elham S.Khorasani Ismail Guneydas Dhawala Kovuri Slide 2 Overview Validation Rules Lookup Fields Multivalued Key Foreign Key Referential Integrity Slide 3 Validation Rules You have created, loaded, queried, and updated a database. To ensure the entry of valid data, Validation Rules are created. Validation Rules ensures that if a field requires an entry, it will be within a specific range or values. Slide 4 To specify a Required Field Show the Navigation pane and then open the Student table in the Design View. Select the SSN Field by clicking its row selector. Click the Required property box in the Field Properties pane, and then click the down arrow that appears. Click Yes in the list. Slide 5 Value changed to yes Slide 6 Specifying a Collection of Allowable Values The only allowable values for Major are Visual Atrs, Cinema, Education, Music, Psychology, Physic, Zoology. For GPA the allowable values are 1 to 4. Slide 7 Validation Rule Validation Text Major Field Selected Slide 8 Validation Text Validation Rule Field Selected Slide 9 To Save the Validation Rules Click the Save button on the Quick access Toolbar to save the changes. Click the NO button to save the changes without testing the current data. Close the Student Table. Slide 10 No should be selected Slide 11 Contd If user enter a value that is different from the Validation Rules then the Validation Text will pop up with the Error Message. Slide 12 Error Message Slide 13 Invalid Entry Slide 14 Creating a Lookup Field Click the Data Type column for the Client Type field, and then click the arrow to display the menu of available data types. Click Lookup Wizard, and then click the I will type in the values that I want. option button to indicate that you will type in the values. Click the Next button to display the next lookup Wizard screen. Slide 15 Contd., Click the first row of the table and then type Education as the value in the first row. Press the DOWN ARROW key, and then type ZOOLOGY as the value in the second row. Press the DOWN ARROW key, and then type CINEMA as the value in the third row and so on Click the Next button to display the next Lookup Wizard screen. Slide 16 Click the Next Slide 17 Slide 18 Slide 19 Slide 20 Slide 21 Multivalued Field Normally, fields contain only a single value. It is possible to have Multivalued Fields, that is, fields that can contain more than one value. For students who have double Major, we need Multivalued Fields since the Major Field will contain more than one value. To create a Multivalued Field, create a Lookup Field being sure to check the Allow Multiple values check box. Slide 22 To Add a Multivalued Field The steps for adding a Multivalued Field is almost similar to creating a Lookup Field. Be sure to check the Allow Multiple values check box (Slide No 24). Slide 23 Click the Next Slide 24 Slide 25 Slide 26 Slide 27 Select Yes Slide 28 Slide 29 Foreign Key A foreign key is a field (or fields) that is the primary key of an entity in another table. The purpose of the foreign key is to ensure referential integrity of the data. In other words, only values that are supposed to appear in the database are permitted. Slide 30 Referential Integrity The property that ensures that the value in a foreign key must match that of another tables primary key is called Referential Integrity. In Access, to specify referential integrity, you must define relationship between the tables using the Relationships command. Access then prohibits any updates to the database that would violate the referential integrity. The type of the relationship between two tables specified by the Relationships command is referred to as a one-to-many relationship. This means that one record in the first table is related to many records in the second table but each record in the second table is related to only one record in the first table. Slide 31 To Specify Referential Integrity Click Database Tools on the Ribbon to display the Database Tools tab. Click Relationships button on the Database Tools tab to open the Relationships window and display the Show Table dialog box. Import Professor.txt from course webpage and open and click the Professor table and then click the Add button to add Professor table. Click the Student table and then click the Add button to add Student table. Click the Close button in the Show Table dialog box to close the dialog box. Resize the field lists that appear so all fields are visible. Slide 32 Contd Drag the Professor ID Number field in the Professor Table field list to the Recruiter Number field in the Client table list to open the Edit Relationships dialog box to create a relationship. Click the Enforce Referential Integrity check box. Click the Cascade Update Related Fields check box Click the Create button to complete the creation of the relationship. Click the save button on the Quick Access Toolbar to save the relationship you created. Close the relationship window by clicking the Close Relationships button. Slide 33 Slide 34 Professor Table Selected Student Table Add buton dialog box Slide 35 Field List for Professor Table and Student Table Prof ID Num Field in Student Table Prof ID Num Field in Professor Table Slide 36 Enforce Referential Integrity selected Cascade Update Related Fields selected Create Button Prof ID Num Fields used to relate tables Edit Relationship Dialog Box Slide 37 One part of the Relationship Many part of the relationship One Prof ID num is related to many Prof Id num Relationship Line