|
Chapter 6: Keeping Your Information Accurate continued
Using the Field Size Property to Restrict DataYou can set the Field Size property for the Text, Number, and AutoNumber data types. This property restricts the number of characters you can enter in a text field and the size of numbers that can be entered in a number or AutoNumber field. For text fields, the Field Size property can be set to any number from 0 to 255. AutoNumber fields are automatically set to Long Integer. Number fields can be set to any of the following values:
By setting the Field Size property to a value that allows the largest valid entry, you prevent the user from entering certain types of invalid information. If you try to type more characters in a text field than the number allowed by the Field Size setting, Access beeps and refuses to accept the entry. Likewise, a value that is below or above the limits of a number field is rejected when you try to move out of the field. In this exercise, you will change the Field Size property for several fields to see what impact this has on data already in the table and on new data you enter. The working folder for this exercise is SBS\Access\Accurate\FieldSize. Follow these steps:
You have just restricted the number of characters that can be entered in the text field to 12 and the values that can be entered in the number field to the range 0 to 255.
The table contains data that doesn’t fit these new property settings, so Access displays a warning, shown on the next page, that some data might be lost.
Your datasheet now looks like this: TextField now contains only 12 characters, rather than the 32 you entered. The other 20 characters have been permanently deleted. NumberField is empty. Because it is now limited to whole numbers from 0 through 255, the value of 500 that you entered has been deleted.
The number is rounded down to the nearest whole number.
Last Updated: Saturday, July 7, 2001 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||