Secondary Teaching Resources for I.C.T. |
DatabasesWhat is a database?
|
DatabasesInput MasksUnlike manual databases such as a card index system, or a stamp collection, and computer based database has several tools that allow you to check the accuracy, or integrity, of the data as you actually enter it. There are two main ways in which Access does this and they are called Input Masks and Validation Rules, which are collectively known as Validation Checks An input mask is a way of making Access check that data fits into a pattern that we specify. A post code follows a set pattern:-
In the postcode example above, the input mask would be:- LL0 LL0
|
Mask Character |
Meaning |
0 |
Digit (0 to 9, entry required, plus [+] and minus [–] signs not allowed). |
L |
Letter (A to Z, entry required). |
9 |
Digit or space (entry not required, plus and minus signs not allowed). |
A |
Letter or digit (entry required). |
a |
Letter or digit (entry optional). |
? |
Letter (A to Z, entry optional). |
C |
Any character or a space (entry optional). |
# |
A number, a space, or a plus or minus sign can be entered in this position. If the user moves the cursor past this position, Access stores a space. |
. |
A decimal point must be entered here. |
, |
Thousand separator |
< |
Converts all letters that follow to lower case |
> |
Converts all letters that follow to UPPER CASE |
Anything else |
Adds the characters to the field, e.g. (000) would allow the user to input three numbers surrounded by brackets. |
Mask |
Acceptable data |
Notes |
(000) 000-0000 | (206)
555-0248 (999) 999-9999 (206) 555-0248 ( ) 555-0248 |
Access will automatically add the brackets and spaces, and will only accept numbers. |
(000) AAA-AAAA | (206)
555-TELE |
This phone number can also contain words. |
#999 | –20 2000 |
The trailing "#" allows a sign to occur at the beginning. |
>L0L 0L0 | T2F 8M4 |
|
00000-9999 | 98115- 98115-3007 |
The zeros mean the data must use a number, and the nines are optional |
>L<?????????????? | Maria Brendan |
The trailing letter is a capital and the rest are Lower case. |
SSN 000-00-0000 | SSN
555-55-5555 |
The letters SSN will always occur. |
Click here to return to the top of the page
Click here to find out about Data Validation
The correct input mask for a postcode would be:-
From the table above, we know that L is a compulsary letter and 0 is a compulsary number, whereas ? and 9 are optional letters and numbers.
This gives us:-
One compulsary letter, then one optional one + one compulsary number then an optional one, followed by a space, then two compulsary letters, one compulsary number and one optional one.
Ten out of ten if you followed that, you must be turning into a Pentium 4!
Page last updated on October 26, 2002 | Contact webmaster, Philip
Waud by clicking here |