Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: Error Updating Field When Adding New Record to Form


View products that this article applies to.

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 (http://support.microsoft.com/kb/289659/EN-US/).

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


Resolution

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

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


Keywords: KB207684, kbprb, kberrmsg

↑ Back to the top

Article Info
Article ID : 207684
Revision : 2
Created on : 6/24/2004
Published on : 6/24/2004
Exists online : False
Views : 297