The Format Property: Determining How Access Displays Data
The Format property enables you to
customize the way Access displays and prints numbers, dates, times, and
text. You can select a predefined format or create a custom format.
Here’s a tip to save you a lot of time: You can move between the two panes of the Design view window by pressing F6.
|
To select a predefined display format (from Design view), follow these steps:
1. | Select the desired field.
|
2. | Click the Format property text box in the Field Properties pane.
|
3. | Click the drop-down arrow that appears after you click in the Format property.
|
4. | Select the desired format based on the type of field you are formatting.
|
You create a custom format by using a combination of the special characters, called placeholders, listed in Table 1.
Table 1. Placeholders That Allow You to Build a Custom Format
Placeholder | Function |
---|
0 | Displays
a digit if one exists in the position; otherwise, displays a zero. You
can use the 0 placeholder to display leading zeros for whole numbers
and trailing zeros for decimals. |
# | Displays a digit if one exists in the position; otherwise, displays a blank space. |
$ | Displays a dollar sign in the position. |
. % , | Displays a decimal point, percent sign, or comma at the indicated position. |
/ | Separates the day, month, and year to format date values. |
M | Used as a month placeholder: m displays 1, mm displays 01, mmm displays Jan, mmmm displays January. |
D | Used as a day placeholder: d displays 1, dd displays 01, ddd displays Mon, dddd displays Monday. |
Y | Used as a year placeholder: yy displays 95, yyyy displays 1995. |
: | Separates hours and minutes. |
h, n, s | Used as time placeholders for h hours, n minutes, and s seconds. |
AM/PM | Displays time in 12-hour format, with AM or PM appended. |
@ | Indicates that a character is required in the position in a text or memo field. |
& | Indicates that a character is optional. |
> | Changes all the text characters to uppercase. |
< | Changes all the text characters to lowercase. |
Create a Custom Display Format
To create a custom display format, follow these steps while in Design view of a form:
1. | Select the desired field.
|
2. | Click the Format text box in the Field Properties pane.
|
3. | Type the desired format, using the placeholders listed in Table 1.
|
Field names, as a general rule, should be short and should not contain spaces. You can, however, assign to the field a Caption property that is descriptive of the field’s contents. Access displays the Caption property as the field label on forms and reports. For example, you can assign ”Fax Number” to the Caption property for a field named FaxNum.
|
The Caption Property: Providing Alternatives to the Field Name
The text you place in the Caption property becomes the caption for fields in Datasheet view. Access also uses the contents of the Caption property as the caption for the attached label it adds to data-bound controls when you add them to forms and reports. The Caption property becomes important whenever you name fields without spaces. Whatever is in the Caption property overrides the field name for use in Datasheet view, on forms, and on reports.
A data-bound control is a control that is bound to a field in a table or query. The term attached label refers to the label that is attached to a data-bound control.
|
Set the Caption Property from Design View
To set the Caption property (from Design view), follow these steps:
1. | Select the desired field name from the top pane of the Design view window.
|
2. | Click the Caption text box in the Field Properties pane.
|
3. | Type the desired caption. |