Share via


Format Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

                 

You can use the Format property to customize the way numbers, dates, times, and text are displayed and printed. For example, if you've created a Price text box, you can set its Format property to Currency and its DecimalPlaces property to 2 or Auto. If you enter 4321.678 in the control, the number would be displayed as $4,321.68.

You can use one of the predefined formats or you can create a custom format by using formatting symbols.

Setting

The Format property uses different settings for different data types. For information about settings for a specific data type, see one of the following topics:

For a control, you can set this property in the control's property sheet. For a field, you can set this property in table Design view (in the Field Properties section) or in Design view of the Query window (in the Field Properties property sheet). You can also use a macro or .

Note   In Visual Basic, enter a string expression that corresponds to one of the predefined formats or enter a custom format.

Remarks

The Format property affects only how data is displayed. It doesn't affect how data is stored.

Microsoft Access provides predefined formats for Date/Time, Number and Currency, Text and Memo, and Yes/No data types. The predefined formats depend on the country specified by double-clicking Regional Settings in Windows Control Panel. Microsoft Access displays formats appropriate for the country selected. For example, with English (United States) selected on the Regional Settings tab, 1234.56 in the Currency format appears as $1,234.56, but when English (British) is selected on the Regional Settings tab, the number appears as 1,234.56.

If you set a field's Format property in table Design view, Microsoft Access uses that format to display data in datasheets. It also applies the field's Format property to new controls on forms and reports.

You can use the following symbols in custom formats for any data type.

Symbol Meaning
(space) Display spaces as literal characters.
"ABC" Display anything inside quotation marks as literal characters.
! Force left alignment instead of right alignment.
* Fill available space with the next character.
\ Display the next character as a literal character. You can also display literal characters by placing quotation marks around them.
[color] Display the formatted data in the color specified between the brackets. Available colors: Black, Blue, Green, Cyan, Red, Magenta, Yellow, White.

You can't mix custom formatting symbols for the Number and Currency data types with Date/Time, Yes/No, or Text and Memo formatting symbols.

When you have defined an input mask and set the Format property for the same data, the Format property takes precedence when the data is displayed and the input mask is ignored. For example, if you create a Password input mask in table Design view and also set the Format property for the same field, either in the table or in a control on a form, the Password input mask is ignored and the data is displayed according to the Format property.