ACC2000: Error Updating Field When Adding New Record to Form (207684)



The information in this article applies to:

  • Microsoft Access 2000

This article was previously published under Q207684
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).

For a Microsoft Access 2002 version of this article, see 289659.

SYMPTOMS

When you type data into a new record on a form that is based on a query or an SQL statement, you receive one of the following error messages:
Field cannot be updated.

or

Multiple-step operation generated errors. Check each status value.
When you click OK, you can continue editing and then save the record.

CAUSE

This behavior occurs when you try to update a read-only field in a record by using either the DefaultValue property or Visual Basic for Applications.

RESOLUTION

Do not use the DefaultValue property or Visual Basic for Applications to edit read-only controls.

MORE INFORMATION

When you create a form based on a query, any control bound to a query field containing an expression is read-only. Because the query expression is not bound to any specific field in the underlying table, you cannot edit the values in these fields. However, when you set the DefaultValue property of such a control, Access attempts to write a new value to that control every time you add a new record.

Steps to Reproduce Behavior

CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

  1. Start Microsoft Access, and then open the sample database Northwind.mdb or the sample project NorthwindCS.adp.
  2. Open the Orders Subform form in Design view.
  3. Select the Extended Price text box; on the View menu, click Properties, and then set the DefaultValue property to 0 (zero).
  4. Close and save the Orders Subform form.
  5. Open the Orders form, and then add a new item to any order. Note that you receive one of the error messages described in the "Symptoms" section.

REFERENCES

For more information about calculated fields, click Microsoft Access Help on the Help menu, type calculating fields in sql functions in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

For more information about calculated controls, click Microsoft Access Help on the Help menu, type create a calculated control on a form or report in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

For more information about the DefaultValue property, click Microsoft Access Help on the Help menu, type defaultvalue property in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

Modification Type:MajorLast Reviewed:6/24/2004
Keywords:kberrmsg kbprb KB207684