The modify Relationships dialog box.

You are watching: What does enforce referential integrity mean

The partnership line between the tblCustomers table and also the tblCustomerTours table indicates a one-to-many relationship.

When you produce a relationship between two tables, it is commonly a great idea to enforce . Therefore what go this technical-sounding phrase mean? Referential truth keeps documents in related areas valid and accurate. Referential verity ensures that you don"t accidentally readjust or delete connected data in one table but not in the other. For example, speak you were using two associated Social Security fields to attach two tables. Referential integrity would not permit you to change the Social protection number in one document without transforming the Social security number in the other related records.Access is an extremely picky about when you can set . You have the right to only usage referential truth when every one of the following conditions are met:One of the connected fields is a major keyThe related fields are the exact same data form and size. (If you room using one AutoNumber field, you can relate it come a Number field with a lengthy Integer field size.)Both tables space in the same accessibility database.You can"t have a record in a related table uneven a corresponding record currently exists in the major table. Orphan data in a connected table is the most typical problem human being encounter once attempting to develop referential integrity.Once friend have established referential integrity, the following rules room set:You can"t include a document to a related table unless a matching record currently exists in the main table.You can"t change the worth of a primary key in the primary table if corresponding records exist in the associated table (unless you pick the ).You can"t delete a document from a main table if matching records exist in a associated table (unless you pick the ).In this great you will certainly learn how to enforce referential integrity. You need to still have actually the open up from the previous great in order to finish this lesson.First, let"s develop a relationship between the tblCustomers table and also the tblCustomerTours table...Drag the CustomerID ar from the tblCustomers table come the CustomerID field in the tblCustomerTours table.The edit Relationships dialog crate appears, as presented in figure. We want to force referential truth so the you can"t go into a CustomerID in the tblCustomerTours table unless that CustomerID number already exists in the tblCustomers table.Check the obtrude Referential integrity box.This will certainly enforce referential integrity between the tables. If you acquire an error message, it"s because your tables and also fields don"t satisfy all the required conditions provided on the vault page.There room two other really important box in the edit Relationships dialog box:Cascade Update related Fields: once you adjust data in the main ar of one table, access will instantly update the equivalent data in the related table.Cascade Delete connected Records: as soon as you delete a record in the key table, accessibility will automatically delete any matching documents in the related table.These room both very powerful optionsthink twice prior to using them.Check both the Cascade upgrade Related areas box and the Cascade Delete Related records box.Now you can save the changes to the relationship.Click develop to develop the relationship between the tblCustomers and tblCustomerTours tables.Access creates the relationship in between the two tables and enforces in between them. Notification that the join line in between the tblCustomers table and the tblCustomerTours table watch a tiny different. This relationship suggests that referential truth is gift enforced between the two tables and also that the tables have actually a one-to-many relationship, as shown in figure (more about that later).Click the Close switch to nearby the Relationships home window and click yes to save the alters you made.In the following lesson you will gain to test the outcomes of your new referential truth settings.

See more: Most Southern Point Of South America S, South America

TO enforce REFERENTIAL INTEGRITY:

IN THE DATABASE WINDOW, CLICK THE RELATIONSHIPS switch ON THE TOOLBAR.OR...RIGHT-CLICK any BLANK AREA IN THE DATABASE window AND select RELATIONSHIPSDOUBLE-CLICK THE sign up with LINE because that THE connection YOU want TO occupational WITH.CHECK THE force REFERENTIAL verity BOX.IF friend WANT transforms TO THE PRIMARY ar OF THE primary TABLE duplicated TO THE RELATED field IN THE related TABLE, examine THE CASCADE upgrade RELATED areas BOX.IF you WANT accessibility TO immediately DELETE ORPHAN documents IN THE connected TABLE, examine THE CASCADE DELETE RELATED records BOX.CLICK OK.