You add a Short Text field to a table when you need to store smaller amounts of textual data, such as names, addresses, and telephone numbers. Short Text fields can store up to 256 alphanumeric characters. You can display all 256 characters in the table field and in a control on a form or report. Unlike Long Text fields, you cannot apply Rich Text formatting to the data in a Short Text field. However, you can apply custom display formats, and you can also apply input masks that control how users enter data.
In this article
Add a Short Text field in Datasheet view
You can add a Short Text field to a new or existing table in Datasheet View.
Add to an existing table
-
Open the table in Datasheet View.
-
If necessary, scroll horizontally to the first blank field.
-
Select Click to Add and then select Short Text from the list.
-
Double-click the new header row, and then type a meaningful name for the new field.
-
Save your changes.
Add to a new table
-
On the Create tab, in the Tables group, click Table.
-
Click Save , and in the Save As dialog box, enter a name for the new table.
-
Select Click to Add and then select Short Text from the list.
-
Double-click the new header row, and then type a meaningful name for the new field.
-
Save your changes.
Add a Short Text field in Design view
You can add a Short Text field to a new or existing table in Design View.
Add to an existing table
-
Open the table in Design View.
-
In the Field Name column, select the first blank row, and then type a name for the field.
-
Select the adjacent cell in the Data Type column, and then select Short Text from the list.
-
Save your changes.
Add to a new table
-
On the Create tab, in the Tables group, click Table.
-
Click Save, and in the Save As dialog box, enter a name for the new table.
-
Right-click the document tab for the new table and click Design View.
-
In the Field Name column, select the first blank row, and then type a name for the field.
-
Select the adjacent cell in the Data Type column, and then select Short Text from the list.
-
Save your changes.
Set or change Short Text field properties
You can use Datasheet View to set a subset of field properties, such as Is Required or Unique, but use Design View to set all available properties, including Input Mask or Caption.
-
Open the table in Design View.
-
On the General tab in the lower section of the table designer, under Field Properties, locate the property that you want to change.
-
Select the field next to the property name. Depending on the property, you can enter data, start the Expression Builder by clicking , or select an option from a list.
For information about how to use each field property, select the property and then press F1.
Delete a Short Text field
Important When you delete a Short Text field that contains data, you lose that data permanently — you cannot undo the deletion. For that reason, you should back up your database before you delete any table fields or other database components.
Delete from Datasheet view
-
Open the table in Datasheet View.
-
Locate the Short Text field, right-click the header row (the name), and then click Delete Field.
-
Click Yes to confirm the deletion.
Delete from Design view
-
Open the table in Design View.
-
Click the row selector (the blank square) next to the Text field, and then press DELETE, or right-click the row selector and then click Delete Rows.
-
Click Yes to confirm the deletion.
Short Text field property reference
When you use Design View to add a Short Text field to a table, you can set and change a number of properties for the field. This table shows the Short Text field properties, describes what each one does, and explains the implications of setting or changing them.
Property | Usage |
Field Size | Controls the size of your Short Text fields. Valid values: 0 to 255. If you leave this property blank, the field accepts 256 characters. |
Format | You enter custom formatting characters to define a display format. Formats defined here appear in datasheets, forms, and reports. |
Input Mask | You define an input mask when you need to control how users enter data in the field. For more information about using input masks, see the article Create an input mask to enter field or control values in a specific format. |
Caption | Specifies the name of your Short Text field. This property accepts up to 2,048 characters. If you don't specify a caption, Access applies the default field name. |
Default Value | Specifies the value that automatically appears in a field when you create a new record. For example, in an addresses table, you can set the default value for the City field to a certain city. When users add a record to the table, they can either accept this value or enter the name of a different city. Maximum length: 255 characters. |
Validation Rule | Specifies requirements for data entered into an entire record, an individual field, or a control. When a user enters data that violates the rule, you can use the Validation Text property to specify the resulting error message. Maximum length: 2,048 characters. For more information about creating validation rules, see the article Create a validation rule to validate data in a field. |
Validation Text | Specifies the text in the error message that appears when users violate a validation rule. Maximum length: 255 characters. For more information about creating validation rules, see the article Create a validation rule to validate data in a field. |
Required | When this property is set to Yes, you must enter a value in the field or in any controls that are bound to the field. In addition, the value cannot be null. |
Allow Zero Length | When this property is set to Yes, you can enter zero-length strings in a field. A zero-length string contains no characters. You use it to indicate that you know no value exists for a field. You enter a zero-length string by typing two double quotation marks with no space between them ("") . |
Indexed | You use an index to speed up queries, sorting, and grouping operations run against large amounts of data. You can also use indexes to prevent users from entering duplicate values. Choices:
|
Unicode Compression | Access uses Unicode to represent data in Text, Long Text, and Hyperlink fields. Because Unicode uses 2 bytes per character instead of 1, it takes up more storage space. To offset this effect and help ensure optimal performance, Access sets the default value of this property to Yes for Text, Long Text, and Hyperlink fields. When the property is set to Yes, any character whose first byte is 0 is compressed when it is stored and uncompressed when it is retrieved. |
IME Mode | Specifies an Input Method Editor, a tool for using English versions of Access with files created in Japanese or Korean versions of Access. Default value: No Control. For more information about using this property, press F1. |
IME Sentence Mode | Specifies the type of data you can enter by using an Input Method Editor. For more information about using this property, press F1. |
Smart Tags | In Access 2010 only, you specify one or more smart tags for the field and any controls bound to the field. Smart tags are components that recognize the types of data in a field and allow you to take action based on that type. For example, in an E-mail Address field, a smart tag can create a new mail message or add the address to a list of contacts. Click to see a list of available smart tags. |
Text Align | Specifies the alignment for data in a Text field. Choices:
|
No comments:
Post a Comment