Presentation is loading. Please wait.

Presentation is loading. Please wait.

Validation Checks that the data entered is sensible.

Similar presentations


Presentation on theme: "Validation Checks that the data entered is sensible."— Presentation transcript:

1 Validation Checks that the data entered is sensible

2 Input masks

3 0 User must enter a digit (0 to 9). 9 User can enter a digit (0 to 9). # User can enter a digit, space, plus or minus sign. If skipped, Access enters a blank space. L User must enter a letter. ? User can enter a letter. A User must enter a letter or a digit. a User can enter a letter or a digit. & User must enter either a character or a space. C User can enter characters or spaces. The character you select depends on your Microsoft Windows regional settings. > Coverts all characters that follow to uppercase. < Converts all characters that follow to lowercase. ! Causes the input mask to fill from left to right instead of from right to left. \ Characters immediately following will be displayed literally. "" Characters enclosed in double quotation marks will be displayed literally.

4 Tasks LEVEL 1 Create an input Mask for a Postcode LEVEL 2 Create an input Mask for a car registration LEVEL 3 User enters a first or last name with the first letter automatically capitalised. LEVEL 4 Or Own INPUT MASK

5 EXPRESSION BUILDER A mathematical expression that checks that the data added is valid and within a ‘valid’ range =Now()

6 EXPRESSION BUILDER

7 Validation

8 OperatorDescriptionExampleComment =Equal to=100Only a number of 100 is accepted <>Not equal to<>0Any number except 0(zero) is accepted <Less than<250Numbers less than 250 are accepted. 250 is not accepted <=Less than or equal to <=250Numbers less than 250 are accepted. 250 is also accepted. >Greater than>1234Numbers greater than 1234 are accepted. 1234 is not accepted. >=Greater than or equal to >=1234Numbers greater than 1234 are accepted. 1234 is also accepted

9 Validation Validation ruleComment >#17/10/03#Only dates later than 17 October 2003 are accepted, but not that date itself. <>#09/02/92#Any date is accepted except 9 February 1992 <=#26/11/95#Only dates earlier than 26 November 1995 are accepted, as is the date itself. =Date()Only today’s date is accepted. <Date()Only dates before today’s date are accepted. Today’s date is not allowed. >=Date()Only today’s date, or any future date, is accepted.

10 To do this...Validation Rule for FieldsExplanation Accept letters (a - z) onlyIs Null OR Not Like "*[!a-z]*" Any character outside the range A to Z is rejected. (Case insensitive.) Accept digits (0 - 9) onlyIs Null OR Not Like "*[!0-9]*" Any character outside the range 0 to 9 is rejected. (Decimal point and negative sign rejected.) Letters and spaces onlyIs Null Or Not Like "*[!a-z OR "" ""]*"Punctuation and digits rejected. Digits and letters onlyIs Null OR Not Like "*[!((a-z) or (0-9))]*" Accepts A to Z and 0 to 9, but no punctuation or other characters. Exactly 8 charactersIs Null OR Like "????????"The question mark stands for one character. Exactly 4 digits Is Null OR Between 1000 And 9999For Number fields. Is Null OR Like "####"For Text fields. Positive numbers onlyIs Null OR >= 0Remove the "=" if zero is not allowed either. No more than 100%Is Null OR Between -1 And 1 100% is 1. Use 0 instead of -1 if negative percentages are not allowed. Not a future dateIs Null OR <= Date() Email address Is Null OR ((Like "*?@?*.?*") AND (Not Like "*[,;]*")) Requires at least one character, @, at least one character, dot, at least one character. Space, comma, and semicolon are not permitted. You must fill in Field1Not Null Same as setting the field's Required property, but lets you create a custom message (in the Validation Text property.) Limit to specific choices Is Null OR "M" Or "F" It is better to use a lookup table for the list, but this may be useful for simple choices such as Male/Female. Is Null OR IN (1, 2, 4, 8)The IN operator may be simpler than several ORs. Yes/No/Null fieldIs Null OR 0 or -1 The Yes/No field in Access does not support Null as other databases do. To simulate a real Yes/No/Null data type, use a Number field (size Integer) with this rule. (Access uses 0 for False, and -1 for True.)

11 Tasks LEVEL 1 Create a validation rule for Male and Female LEVEL 2 Create a validation rule for a numerical field (above or below a certain number) LEVEL 3 Create your own validation rule

12 DATA VALIDATION LISTS


Download ppt "Validation Checks that the data entered is sensible."

Similar presentations


Ads by Google