Editing Fields and Their Properties

After you've created a table with the Table Wizard or from scratch, you might find that you want to fine-tune the table's structure. This requires that you edit your fields and their properties.

You can delete fields, add new fields, or change the order of fields in the table. You also can change a field's data type. Because the table's structure is discussed here and not the data, you need to work in the Table Design view.

graphics/cation_icon.gif

Get the Table's Structure Down Before Entering Data You should try to finalize the table's field structure and properties before you enter data. Changing data types or other field properties can actually delete data that you've already entered into the table.


You can open an existing table in the Table Design view in several ways:

  • In the database window, click the Table object icon, select the table you want to work with in the right pane of the database window, and then click the Design button on the database window's toolbar.

  • Right-click the table in the database window and select Design View from the shortcut menu that appears.

  • graphics/datasheetview.gif If you are in the table's Datasheet view, click the View button on the Table Datasheet view toolbar.

Changing Field Names and Data Types

When you are in the Design view (see Figure 5.1), you can enhance or rework your table's structure. For example, you can change a field's name. Just double-click the field's current name and type in a new one.

Figure 5.1. A table's existing structure can be edited in the Design view.

graphics/77fig01.jpg

You can also change the data type for an existing field. Click the field's Data Type box and select a new data type from the drop-down list. Remember that when you change a field name or a field's data type, you must save the changes that you've made to the table's structure.

Setting Field Properties

Field properties can also be edited for each field using the various Properties boxes found in the Field Properties pane on the lower half of the table's window in Design view. Lesson 4, "Creating a Table from Scratch," provides a quick overview of some of the properties that are available.

Another very useful field property, particularly for fields that use text entries (remember that text entries can include numbers ) is an input mask . An input mask is used to format data as you enter it into a field. For example, you might want to enter a date in a particular format, such as the format xx/xx/xxxx. The input mask can be used so that when you enter the data into the date field, all you need to enter is the two-digit input for the month and day, and four digits for the year. Access automatically places the slashes in the field for you.

graphics/term_icon.gif

Input Mask A field property that limits the number of characters that can be entered in a field.


Input masks are also very useful for entering ZIP codes. The input mask limits the number of characters that can be entered (such as those in a ZIP code), and if you use the 5-4 ZIP code format, the input mask can place the dash into the ZIP code for you.

To create an input mask for a field (such as a date field), follow these steps:

  1. Click in the Field Name box to select the field for which you want to create the input mask.

  2. In the Field Properties pane, click in the Input Mask box . The Input Mask Wizard button appears in the box.

  3. Click the Input Mask Wizard button to open the dialog box shown in Figure 5.2.

    Figure 5.2. The Input Mask Wizard helps you create an input mask for a field.

    graphics/77fig02.jpg

  4. The Input Mask Wizard offers a list of possible masks for the field based on the field's data type. For example, Figure 5.2 shows the Input Mask Wizard used for a field with the Date data type. Select one of the mask formats listed, and then click Next .

  5. The next wizard screen shows you the input mask you have chosen and gives you the opportunity to change the format. You can also test the input mask format by typing some data into the Try It box. Edit the input mask format if necessary and then click Next to continue.

  6. You are taken to the last wizard screen. Click Finish to create the input mask. The input mask appears in the Input Mask box in the Field Properties pane (see Figure 5.3).

    Figure 5.3. The input mask appears in the Input Mask box.

    graphics/77fig03.jpg

  7. Click the Save button to save changes that you have made to the table structure.



Microsoft Office 2003 All-in-One
Microsoft Office 2003 All-in-One
ISBN: B005HKSHB2
EAN: N/A
Year: 2002
Pages: 660
Authors: Joe Habraken

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net