You are on page 1of 6

Data Type Property:

You can use the Data Type property to specify the type of data stored in a table field. Each field can store data consisting of only a single data type.

Setting:
The Data Type property uses the following settings. Size !p to "## characters or the length (Default) Text or combinations of text set by the Field Size property, and numbers, as well as numbers that Text whiche$er is less. %icrosoft &ccess don't re uire calculations, such as does not reser$e space for unused phone numbers. portions of a text field. !p to (#,#)# characters. (*f the %emo field is manipulated through D&+ and only text and numbers 'engthy text or combinations of text %emo ,not binary data- will be stored in and numbers. it, then the si.e of the %emo field is limited by the si.e of the database.) /umeric data used in mathematical 1, ", 2, or 3 bytes (1( bytes if the calculations. 0or more information on /umber Field Size property is set to how to set the specific /umber type, 4eplication *D). see the Field Size property topic. Date and time $alues for the years 166 Date5Time 3 bytes. through 7777. 8urrency $alues and numeric data used in mathematical calculations in$ol$ing data with one to four decimal places. 8urrency 3 bytes. &ccurate to 1# digits on the left side of the decimal separator and to 2 digits on the right side. & uni ue se uential (incremented by 1) number or random number assigned by %icrosoft &ccess whene$er a new 2 bytes (1( bytes if the Field Size &uto/umber record is added to a table. &uto/umber property is set to 4eplication *D). fields can't be updated. 0or more information, see the New Values property topic. Yes and /o $alues and fields that Yes5/o contain only one of two $alues 1 bit. (Yes5/o, True/0alse, or +n5+ff). Setting Type of data

You can set this property only in the upper portion of Table Design $iew.

Format Property:
You can use the Format property to customi.e the way numbers, dates, times, and text are displayed and printed. 4ead5write String. expression. Format expression list. 4e uired. &n expression that returns one of the ob9ects in the &pplies To

You can use one of the predefined formats or you can create a custom format by using formatting symbols. The Format property uses different settings for different data types. 0or information about settings for a specific data type, see one of the following topics:

Date5Time Data Type /umber and 8urrency Data Types Text and %emo Data Types

*f you set a field's Format property in table Design $iew, %icrosoft &ccess uses that format to display data in datasheets. *t 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. ;&<8; Display anything inside uotation mar=s as literal characters. > 0orce left alignment instead of right alignment. ? 0ill a$ailable space with the next character. Display the next character as a literal character. You can also display literal @ characters by placing uotation mar=s around them. Display the formatted data in the color specified between the brac=ets. &$ailable ,colorcolors: <lac=, <lue, Areen, 8yan, 4ed, %agenta, Yellow, Bhite. You can't mix custom formatting symbols for the /umber and 8urrency data types with Date5Time, Yes5/o, or Text and %emo formatting symbols.

Decimal Places Property:


You can use the Decimal Places property to specify the number of decimal places %icrosoft &ccess uses to display numbers. 4ead5write yte.

expression. Decimal Places expression list. 4e uired. &n expression that returns one of the ob9ects in the &pplies To

The Decimal Places property uses the following settings. Visual Description asic &uto "## (Default) /umbers appear as specified by the Format property setting. Digits to the right of the decimal separator appear with the specified 6 to 1# 6 to 1# number of decimal placesC digits to the left of the decimal separator appear as specified by the Format property setting. Setting You should set the Decimal Places property in the table's property sheet. & bound control you create on a form or report inherits the Decimal Places property set in the field in the underlying table or uery, so you won't ha$e to specify the property indi$idually for e$ery bound control you create.

!nput Mas" Property:


You can use the !nput Mas" property to ma=e data entry easier and to control the $alues users can enter in a text box control. 4ead5write String. expression. !nputMas" expression list. 4e uired. &n expression that returns one of the ob9ects in the &pplies To

*nput mas=s are helpful for dataDentry operations such as an input mas= for a Ehone /umber field that shows you exactly how to enter a new number: (FFF) FFFDFFFF. *t is often easier to use the *nput %as= Bi.ard to set the property for you. The !nput Mas" property can contain up to three sections separated by semicolons (C). Description Gpecifies the input mas= itselfC for example, >(777) 777D7777. 0or a list of 0irst characters you can use to define the input mas=, see the following table. Gpecifies whether %icrosoft &ccess stores the literal display characters in the table when you enter data. *f you use 6 for this section, all literal display Gecond characters (for example, the parentheses in a phone number input mas=) are stored with the $alueC if you enter 1 or lea$e this section blan=, only characters typed into the control are stored. Third Gpecifies the character that %icrosoft &ccess displays for the space where you should type a character in the input mas=. 0or this section, you can use any Section

characterC to display an empty string, use a space enclosed in uotation mar=s (; ;).

Bhen you create an input mas=, you can use special characters to re uire that certain data be entered (for example, the area code for a phone number) and that other data be optional (such as a telephone extension). These characters specify the type of data, such #$ample The following table shows some useful input mas=s and the type of $alues you can enter in them. !nput mas" (666) 666D6666 (777) 777D7777 Sample %alues ("6() ###D6"23 ("6() ###D6"23 ( ) ###D6"23 (666) &&&D&&&& ("6() ###DTE'E H777 I"6

&aption Property:
You can use the &aption property to pro$ide helpful information to the user through captions on ob9ects in $arious $iews:

0ield captions specify the text for labels attached to controls created by dragging a field from the field list and ser$es as the column heading for the field in table or uery Datasheet $iew. 0orm captions specify the text that appears in the title bar in 0orm $iew. 4eport captions specify the title of the report in Erint Ere$iew. <utton and label captions specify the text that appears in the control.

4ead5write String. expression. &aption expression 4e uired. &n expression that returns one of the ob9ects in the &pplies To list

The &aption property is a string expression that can contain up to ",623 characters. 8aptions for forms and reports that are too long to display in the title bar are truncated. *f you don't specify a caption for a table field, the field's Field Name property setting will be used as the caption of a label attached to a control or as the column heading in

Datasheet $iew. *f you don't specify the caption for a uery field, the caption for the underlying table field will be used. *f you don't set a caption for a form, button, or label, %icrosoft &ccess will assign the ob9ect a uni ue name based on the ob9ect, such as ;0orm1;.

Default Value Property:


Gpecifies a String $alue that is automatically entered in a field when a new record is created. 0or example, in an &ddresses table you can set the default $alue for the 8ity field to /ew Yor=. Bhen users add a record to the table, they can either accept this $alue or enter the name of a different city. 4ead5write. expression. Default Value expression list. 4e uired. &n expression that returns one of the ob9ects in the &pplies To

The Default Value property doesn't apply to chec= box, option button, or toggle button controls when they are in an option group. *t does howe$er apply to the option group itself.

The Default Value property applies to all table fields except those fields with the data type of &uto/umber or +'E +b9ect.

The Default Value property specifies text or an expression that's automatically entered in a control or field when a new record is created. 0or example, if you set the Default Value property for a text box control to =Now(), the control displays the current date and time. The maximum length for a Default Value property setting is "## characters. The Default Value property is applied only when you add a new record. *f you change the Default Value property, the change isn't automatically applied to existing records.

Validation 'ule Property:


You can use the Validation 'ule property to specify re uirements for data entered into a record, field, or control. Bhen data is entered that $iolates the Validation 'ule setting, you can use the Validation Te$t property to specify the message to be displayed to the user. The Validation 'ule and Validation Te$t properties don't apply to chec= box, option button, or toggle button controls when they are in an option group. They apply only to the option group itself. Enter an expression for the Validation 'ule property setting and text for the Validation Te$t property setting. The maximum length for the Validation 'ule property setting is "623 characters. The maximum length for the Validation Te$t property setting is "## characters. You can set the Validation 'ule and Validation Te$t properties by using:

The 0ield Eroperties section of table Design $iew (for a field $alidation rule).

The property sheet for a table by clic=ing Properties on the View menu in table Design $iew (for a record $alidation rule). The property sheet for a control on a form. & macro or Jisual <asic. *n Jisual <asic, use a string expression to set these properties.

%icrosoft &ccess automatically $alidates $alues based on a field's data typeC for example, %icrosoft &ccess doesn't allow text in a numeric field. You can set rules that are more specific by using the Validation 'ule property.*f you set the Validation 'ule property but not the Validation Te$t property, %icrosoft &ccess displays a standard error message when the $alidation rule is $iolated. *f you set the Validation Te$t property, the text you enter is displayed as the error message. The following table contains expression examples for the Validation 'ule and Validation Te$t properties. Validation Te$t property KL 6 Entry must be a non.ero $alue. Entry must be blan= or greater than L 1666 +r *s /ull 1666. Entry must be # characters and begin 'i=e ;&MMMM; with the letter ;&;. LN H15157(H &nd KH15157OH Entry must be a date in 177(. Entry must be a uni ue 8ustomer*D D'oo=up(;8ustomer *D;, ;8ustomers;, (domain aggregate functions are ;8ustomer *D N 0orms>8ustomers>8ustomer*D;) allowed only for formDle$el *s /ull $alidation). *f you create a $alidation rule for a field, %icrosoft &ccess doesn't normally allow a Null $alue to be stored in the field. *f you want to allow a Null $alue, add ;*s /ull; to the $alidation rule, as in ;KL 3 +r *s /ull; and ma=e sure the re(uired property is set to /o. Validation 'ule property

You might also like