• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 6. Entering, Editing, and Valida... > Testing Field and Table Validation R...

Testing Field and Table Validation Rules

You can experiment with with entering table data and testing your validation rules at the same time. Testing database applications often requires much more time and effort than creating them. The following basic tests are required to confirm your validation rules:

  • Referential integrity— Type 25 in the EmployeeID field and 2 in the InitiatedBy field of the default blank record (number 10) and then press the up-arrow key. Pressing the up-arrow key tells Access that you're finished with the current record and to move up to the preceding record with the cursor in the same field. Access then tests the primary-key integrity before enabling you to leave the current record. If you've turned off the Office Assistant, the message box shown in Figure 6.11 appears; otherwise the Assistant delivers the message. Click OK and press Escape to abandon the entry.

    Figure 6.11. If you violate referential integrity rules by typing an EmployeeID value without a corresponding record in the Employees table, this message appears.

  • No duplicates restriction for primary key— In the record just added, attempt to duplicate exactly the entries for record 9, and then press the up-arrow key. You see the message box shown in Figure 6.12, if you've turned off the Assistant. Click OK and press Escape to cancel the entry.

    Figure 6.12. If you duplicate the values of another record in the EmployeeID, ActionType, and ScheduledDate fields, you receive an error message because a primary key duplication occurs.

  • ActionType validation— Type x and press the right-arrow key to display the message that appears if you added the lookup list and set the Limit To List property value to Yes (see Figure 6.13, top). Otherwise, the message box with the validation text you entered for the ActionType field appears (see Figure 6.13, bottom). Click OK and press Escape to abandon the entry.

    Figure 6.13. The error message for a lookup list with the Limit To List restriction set responds to an entry error with the upper message. If the Limit To List restriction is missing or you didn't add a lookup list, the Validation Text message appears.

  • Employee ID validation in the InitiatedBy field— Type q and move to the InitiatedBy field. When the cursor leaves the ActionType field, the q changes to Q because of the > format character used. Type 0 (an invalid employee ID number), and press the right-arrow key to display the message box shown in Figure 6.14. Click OK or press Enter.

    Figure 6.14. Typing 0 in the InitiatedBy field violates the >0 Validation Rule and displays the Validation Text.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint