Lesson4.12.Setting a Default Value


Lesson 4.12. Setting a Default Value

Figure 4-15. A field's default value


Figure 4-16. The for the State field automatically appears in a new record.


You can enter a default value to specify a value that is automatically entered in a field when a new record is created. For example, if most of your clients are from Texas, you could set the default value for the State field to "TX." When a user adds a record to the table, they can either accept the "TX" default value for the State field or enter their own value.

  1. Switch to Design view by clicking the View button on the toolbar.

    Since the majority of your customers are from Minnesota, you decide to add "MN" as the default value for the State field.

  2. Click the State field.

    Now you can add a default value to the State field

  3. Click the Default Value box and type MN, as shown in Figure 4-15.


    Tip: A common default value used in Date fields is the current date. To automatically add the current date, type =Date( ) in the field.

    Let's see how the new default value works.

  4. Click the Save button on the toolbar to save your changes, and then click the View button to display the table in Datasheet view.

    You will need to add a new record in order to see any .

  5. Click the New Record button on the Record Navigation bar.

    Access adds a new blank record to the table. Notice that the State field already contains the "MN" default value, as shown in Figure 4-16. If the customer is from another state, you can simply replace the default value with your own data.

QUICK REFERENCE

TO ENTER A DEFAULT VALUE FOR A FIELD:

  1. MAKE SURE THE TABLE IS DISPLAYED IN DESIGN VIEW AND CLICK THE FIELD YOU WANT TO ADD A DEFAULT VALUE TO.

  2. CLICK THE DEFAULT VALUE BOX IN THE FIELD PROPERTIES SECTION.

  3. ENTER THE DEFAULT VALUE YOU WANT TO APPEAR IN THE FIELD FOR NEW RECORDS.




CustomGuide Inc - Access 2003 Personal Trainer
Access 2003 Personal Trainer (Personal Trainer (OReilly))
ISBN: 0596009372
EAN: 2147483647
Year: 2005
Pages: 209

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