Insert, create, or delete a field to store numeric values Access 2007

Author: mety Nagm Labels:: , ,



You use a Number field for all mathematical calculations except those involving money and those that require a high degree of accuracy, or for figures that you don't want to round up or down (you use a Currency field to prevent rounding). The size of the values that you store in a Number field depends on how you set the Field Size property. For example, you can set Number fields to contain 1-byte, 2-byte, 4-byte, 8-byte, or 16-byte values, plus Replication IDs (globally unique identifier values, or GUIDs) and decimal values.
You set the field size by opening the table in Design view and changing the Field Size property.

The following table lists the values that each Field Size setting can contain and explains when to use each size setting.
Field Size settingDescription
ByteA 1-byte integer containing values from 0 to 255.
IntegerA 2-byte integer containing values from -32,768 to +32,767.
Long IntegerA 4-byte integer containing values from -2,147,483,648 to 2,147,483,647.
SingleA 4-byte integer containing values from -3.4 x 1038 to +3.4 x 1038 and up to 7 significant digits.
DoubleAn 8-byte floating point number containing values from -1.797 x 10308 to +1.797 x 10308 and up to 15 significant digits.
Replication IDA 16-byte globally unique identifier (GUID). Randomly generated GUIDs are long enough that they are not likely to overlap. You use them for a variety of applications, such as tracking goods.
DecimalA 12-byte integer with a defined decimal precision that can contain values from -1028 to +1028. The default precision is 0. The default scale (the number of decimal places displayed) is 18. You can set the scale up to 28.
In addition to setting field sizes and other field properties, you can apply custom and predefined display formats and input masks to your number data.

Methods for creating a Number field

Office Access 2007 provides several ways to add a Number field to a new or existing table:
  • Datasheet view You can add a Number field to a new or existing table in Datasheet view by adding a new field and then typing a number into a blank row in the field, or by pasting a number into a blank row. You can also select the Number data type from a drop-down list and set properties such as Is Required, which forces users to enter a date in the field, and Unique, which forces users to enter a non-duplicate value in the field.
  • Design view You use Design view to add a Number field and set properties for the field that you cannot set in Datasheet view. Those properties include input masks and a default value for the field.

Add a Number field in Datasheet view

The steps in this section explain how to add a Number field to an existing table and a new table in Datasheet view. If you are new to Access, a datasheet is a grid that is similar in appearance to an Office Excel 2007 worksheet.

Add a Number field to an existing table

  1. Click the Microsoft Office Button Button image, and then click Open.
  2. In the Open dialog box, select and open the database.
  3. In the Navigation Pane, double-click the table that you want to change. Access opens the table in Datasheet view.
  4. If necessary, scroll horizontally to the first blank field. By default, Access displays Add New Field in the header row of all new fields, like so: A new field in a datasheet
  5. Double-click the header row, and then type a name for the new field.
  6. Select the first blank row under the header, and then type or paste a block of numbers. Access infers the Number data type for the field when you enter numbers or paste numbers. -or-
    On the Datasheet tab, in the Data Type & Formatting group, from the Data Type list, select Number, and then from the Format list, select the number format you want.
    If you type or paste data into the field, Access sets the Field Size setting based on the size of the number that you enter.
  7. Save your changes.

Add a Number field to a new table

  1. Click the Microsoft Office Button Button image, and then click Open.
  2. In the Open dialog box, select and open the database.
  3. On the Create tab, in the Tables group, click Table. Access opens the new table in Datasheet view. This figure illustrates a new table:
    A new, blank table in a new database
  4. Click Save Button Image, and in the Save As dialog box, enter a name for the new table.
  5. Double-click the header row for the first table field (the one labeled Add New Field), and then type a name for the field.
  6. Select the first blank row under the header, and then type a block of numbers. Access infers the Number data type for the field when you enter numbers. In addition, Access sets the Field Size property based on the size of the number that you enter or paste.

Add a Number field in Design view

You use Design view to add a Number field to a new or existing table and then to set or change the field properties that you can't set or change in Datasheet view. For example, you can specify an input mask or a default value. The steps in this section explain how to add a Number field and set properties for the field.

Add a Number field to an existing table

  1. Click the Microsoft Office Button Button image, and then click Open.
  2. In the Open dialog box, select and open the database.
  3. In the Navigation Pane, right-click the table that you want to change, and then click Design View Button image.
  4. In the Field Name column, select the first blank row, and then type a name for the field.
  5. Select the adjacent cell in the Data Type column, and then select Number from the list.
  6. Save your changes.

Add a Number field to a new table

  1. Click the Microsoft Office Button Button image, and then click Open.
  2. In the Open dialog box, select and open the database.
  3. On the Create tab, in the Tables group, click Table.
  4. Click Save, and in the Save As dialog box, enter a name for the new table.
  5. Right-click the document tab for the new table and click Design View on the shortcut menu.
  6. In the Field Name column, select the first blank row and type a name for the field.
  7. Select the adjacent cell in the Data Type column, and then select Number from the list.
  8. Save your changes. If you want to set properties for the field, leave the table open in Design view and go to the next steps.

Set or change field properties

  1. On the General tab in the lower section of the table designer, under Field Properties, locate the property that you want to change.
  2. Select the field next to the property name. Depending on the property, you enter data (such as default text or an input mask), 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 Number field

You can use Datasheet view or Design view to delete a Number field from a table. However, when you delete a Number 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 a Number field in Datasheet view

  1. Click the Microsoft Office Button Button image, and then click Open.
  2. In the Open dialog box, select and open the database.
  3. In the Navigation Pane, double-click the table that you want to change. Access opens the table in Datasheet view.
  4. Locate the Number field, right-click the header row (the field name), and then click Delete Column.

Delete a Number field in Design view

  1. Click the Microsoft Office Button Button image, and then click Open.
  2. In the Open dialog box, select and open the database.
  3. In the Navigation Pane, right-click the table that you want to change, and then click Design View. Access opens the table in Design view.
  4. Click the row selector (the blank square) next to the Number field, and then press DELETE. -or-
    Right-click the row selector, and then click Delete Rows.
  5. Click Yes to confirm the deletion.

Number field property reference

When you use Design view to add a Number field to a table, you can set and change several properties for the field. This table lists and describes the Number field properties and explains the implications of setting or changing them.
PropertyUsage
Field SizeControls the size of the value that you can enter and store in the field.
FormatYou enter custom formatting characters to define a display format. Formats defined here appear in datasheets, forms, and reports.
Decimal PlacesSets the number of decimal places for the values in the field. Default value: Auto. Other possible values range from 0 to 15.
Input MaskYou define an input mask when you need to control how users enter data in the field.
CaptionSpecifies the name of your Text field. This property accepts up to 2,048 characters. If you don't specify a caption, Access applies the default field name.
Default ValueSpecifies the value that automatically appears in a field when you create a new record.
Validation RuleSpecifies the requirements for data entered into an entire record, an individual field, or a control. When users enter data that violates the rule, you can use the Validation Text property to specify the resulting error message. Maximum length: 2,048 characters.
Validation TextSpecifies the text in the error message that appears when users violate a validation rule. Maximum length: 255 characters.
RequiredWhen this property is set to Yes, you must enter a value in the field or in any controls bound to the field. In addition, the value cannot be null.
IndexedYou 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:
  • No Turns off indexing (default).
  • Yes (Duplicates OK) Indexes the field and allows duplicate values. For example, you may have duplicate first and last names.
  • Yes (No Duplicates) Indexes the field and does not allow duplicate values.
Smart TagsYou 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 Build (...) to see a list of available smart tags.
Text AlignSpecifies the alignment for data. Choices:
  • General Aligns text to the left, numbers and dates to the right (default setting).
  • Left Aligns all text, dates, and numbers to the left.
  • Right Aligns all text, dates, and numbers to the right.
  • Center Centers all text, dates, and numbers.
  • Distribute Justifies all text, dates, and numbers evenly against both sides of the field or text box



0 comments |

Labels

Blog Archive

Powered by Blogger.

I made these pages for me and my friends to help solving the problem we face regarding Computer & internet, if anyone wants me to answer a question or find out about some information please send me email and I will try to reply.*P.S. some of the article I wrote and the other I found on the internet I posted them in sprit of learning and shearing, please forgive me if you found something you don’t want to be in my blog, email me and I will delete them. Thank you for your interest in my pages.امل نجم Amal Nagm

banner 1 banner 2