Presentation is loading. Please wait.

Presentation is loading. Please wait.

Microsoft Access Validation Rules, Table Relationships And

Similar presentations


Presentation on theme: "Microsoft Access Validation Rules, Table Relationships And"— Presentation transcript:

1 Microsoft Access Validation Rules, Table Relationships And
Action Queries

2 Objectives Understand and use data validation
Establish table level relationships Define and create an action query

3 Part One Validation Rules

4 Validation Rules and Text
Property is an object characteristic that defines how that object will look and behave Validation properties maintain data integrity Reduce errors Simplify the entry process Two validation properties in Access Validation Rule Validation Text

5 Validation Rules and Text
Validation Rule property Rejects a record when data is entered that does not agree to the rules as set out in this property Validation Text property Provides the user with a message that tells them how the data should be entered Validation Text is not required when using Validation Rule, however strongly recommended

6 Change Field properties
Switch to Design View Format property: @: text character or space is required Example: displays as > : force upper case characters < : force lower case characters &: text character is optional Example: four out five characters are required and the 5th is optional (12-34 or )

7 Change Field properties …
Default Value property: Enables automatic insert of a field value when a new record is created Input Mask: Controls how data is entered in the field Example: (000)000-AAAA would accept a combination of numbers (first six) and characters (last four). The display would be: (___)___-_____ Validation Rule: Limits what the user can enter in the field. Example: > 0 And < 9 would limit the display to numbers in this range (between 0 and 9).

8 Default Value property Format Property

9 Validation Rule Examples
Symbol Example Meaning <> <>50 Value entered must not be 50 Like Like “Jones” Value entered must be Jones And >5 and <15 Value entered must be greater than 5 and less than 15 Or “B” or “R” Value entered must be either B or R Not Not “Red” Value entered must not be Red * Like A* Value entered must begin with the letter A ? Like Mi??le Value must begin with Mi, end with le, and have two characters in the middle = =10 Value entered must equal 10

10 Example of Input Mask Example Meaning Must enter digit 9
Must enter digit 9 Must enter a digit or space L Must enter letter ? May enter letter A Must enter letter or text a May enter letter or text & Must enter any character or a space C May enter any character or a spase

11 Relationships and Referential Integrity
Part Two

12 Relationships Connecting fields with like information, or physically joining two (or more) tables In the Relationship window Relationship is at the table level When queries are created Relationship is at the query level Table level relationships take precedence over query level relationships

13 Table-level Relationships
The Relationships window used to define, view and edit table relationships When properly designed, every table in a database is related to at least one other table in the database A table may be related to more than one other table Important to know which will be the “parent” table and which will be the “child” table in the relationship

14 Table-level Relationships
Parent In a one-to-many relationship the “parent” is the “one” in the relationship Referred to as the primary table Child In a one-to-many relationship the “child” is the “many” in the relationship These definitions also apply to query level relationships

15 Relationships Four types of relationships One-to-one Rarely used
One record in a table has one record in another table One-to-many One record in a table has many records in another table Many-to-one Also known as lookup table relationship Many records in a table have one record in another table

16 Relationships Many-to-many Most difficult of all relationships
Needs a new table especially created for the relationships, junction table May be thought of as par of one-to-many relationships between two tables Many records in a table have many records in another table

17 Forming Relationships
Primary Key Most often the field chosen when defining a relationship Joined fields should be the same name, must be the same data type Once a primary key is selected, Access prevents any duplicate or Null values from being entered in the primary key fields Foreign Key One or more table fields that refer to the primary key field in the primary table Indicates how the tables are related

18 Relationships Window CustomerID is primary key Join line
in Customers table Join line Enforce Referential Integrity CustomerID is foreign key in Loans table

19 Referential Integrity
Rules that help to maintain accuracy between tables Parent-child relationship exists between linked tables First table is the parent Table the parent is linked to is the child Establishing referential integrity prevents the creation of an orphan Ensures related tables are consistent with one another

20 Referential Integrity
Parent Child This is a one-to-many relationship Notice the number “1” by the parent relationship line Notice the “∞” by the child

21 Referential Integrity Rules
Primary record (parent key) must exist before the child may use that key Parent record cannot be deleted if it still has “child” records Parent table field that is linked to the child cannot have its value or data changed so long as it has children

22 Referential Integrity
Cascade Update: When selected any changes made to the key value of the primary table will be applied to records in the related tables For example, if “Customer ID” is the primary key in the parent table, and is the foreign key in the child table, then any changes made to the Customer ID in the parent table will be automatically reflected in the child table

23 Referential Integrity
Cascade Delete: When selected related records will be deleted when the primary record is deleted

24 Multiple-Table Queries
One-to-many relationship Primary key Foreign key Referential integrity Word Wrap - text automatically wraps text from one line to the next without pressing the enter key Hard Return - created by the user when the enter key is pressed Soft Return - created by the word processor as it wraps text from one line to the next Insertion Point - Flashing vertical line that marks the place where text will be entered Toggle Switch - A switch that causes the computer to alternate between two modes. For example, Caps Lock alternates between uppercase and lower case. Insert Mode - Moves existing text to the right as new characters are being added. Insert key toggles between insert and overtype mode., Overtype Mode - Types over existing characters as new characters are added. Used for correcting typos. Normal View - this view shows the only the body of the current page; faster and preferable when entering text and editing (See Figure 1.6 page 15 in textbook) Page Layout View - this view shows the complete page with headers, footers and all formatting applied (See Figure 1.7 page 16 in textbook) AutoCorrect Feature - corrects predefined spelling errors and/or mistakes in capitalization, automatically as the words are entered.

25 Multiple Table Query Primary key in Consultants Table Relationship
between tables (one to many) Foreign key in Clients Table Each field & table to display

26


Download ppt "Microsoft Access Validation Rules, Table Relationships And"

Similar presentations


Ads by Google