1 / 37

Access Manual 4

Access Manual 4. By Elham S.Khorasani Ismail Guneydas Dhawala Kovuri. Overview. Validation Rules Lookup Fields Multivalued Key Foreign Key Referential Integrity. Validation Rules. You have created, loaded, queried, and updated a database.

calais
Télécharger la présentation

Access Manual 4

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Overview • Validation Rules • Lookup Fields • Multivalued Key • Foreign Key • Referential Integrity

  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.

  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.

  5. Value changed to yes

  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.

  7. Major Field Selected Validation Rule Validation Text

  8. Field Selected Validation Rule Validation Text

  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.

  10. No should be selected

  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.

  12. Error Message

  13. Invalid Entry Error Message

  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.

  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.

  16. Click the Next

  17. 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.

  18. 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).

  19. Click the Next

  20. Select Yes

  21. 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.

  22. Referential Integrity • The property that ensures that the value in a foreign key must match that of another table’s 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.

  23. 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.

  24. 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.

  25. Add buton dialog box Professor Table Selected Student Table

  26. Prof ID Num Field in Student Table Prof ID Num Field in Professor Table Field List for Professor Table and Student Table

  27. Edit Relationship Dialog Box Prof ID Num Fields used to relate tables Enforce Referential Integrity selected Create Button Cascade Update Related Fields selected

  28. One part of the Relationship Relationship Line Many part of the relationship One Prof ID num is related to many Prof Id num

More Related