ACC2002: Default Value Displayed as #Error in New Record (282377)



The information in this article applies to:

  • Microsoft Access 2002

This article was previously published under Q282377
Novice: Requires knowledge of the user interface on single-user computers.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

SYMPTOMS

When you open a table in Datasheet view, the New Record line displays "#Error" instead of its default value as expected.

CAUSE

In a Microsoft Access project (.adp), this behavior occurs when the length of the Default value is longer than the Length property of the field. For example, if the default value of a Char(9) field is the word "tenletters," "#Error" appears in the new record line.

In an Access database (.mdb), this behavior occurs when the length of the Default value of a Text field is longer than the FieldSize property of the field.

RESOLUTION

To display the default value correctly, either change the Length property of the field (FieldSize in an Access database), or type a Default value that is smaller than the length of the field. For example, if the Default value is the string "tenletters" in a Char(9) field, change the Length property of the field to 10.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Open the sample project NorthwindCS.adp.
  2. Create a new table with the following fields:
       Name    Type    FieldSize    Other Properties
       ------------------------------------------------------------
       ID      int                  do not allow nulls, primary key
       DV      char     9           default value: 'tenletters'
    					
  3. Save the table as Table1, and then open it in Datasheet view. Note that the DV field displays "#Error" in the New Record line.

REFERENCES

For more information about default values, click Microsoft Access Help on the Help menu, type default value in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

For more information about the FieldSize property, click Microsoft Access Help on the Help menu, type change a field's data type or size in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

Modification Type:MajorLast Reviewed:11/5/2003
Keywords:kberrmsg kbprb KB282377