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: Can't Change Combo Box Value If ControlSource AutoNumber


View products that this article applies to.

This article was previously published under Q209681

↑ Back to the top


Symptoms

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).

If the ControlSource property of a combo box is set to a field that has an AutoNumber data type or that is automatically populated, you receive the following message on the status bar when you try to change the value in the combo box:
Control can't be edited; it's bound to AutoNumber field <fieldname>.

↑ Back to the top


Cause

The control source of a combo box is a table field where Microsoft Access writes your combo box selection. Modifications to an AutoNumber or an automatically populating field are not allowed. Therefore, if the ControlSource property of a combo box is set to one of these fields, Microsoft Access cannot update the value in the field; therefore, you cannot change the combo box value. Microsoft Access gives you the message to tell you why it cannot update the combo box control.

↑ Back to the top


Resolution

Either change the data type of the field in the ControlSource property of the combo box, or set the ControlSource property to a field that does not have an AutoNumber or an automatically populating data type.

↑ Back to the top


More information

Steps to Reproduce Behavior

  1. Start Microsoft Access, and open the sample database Northwind.mdb.
  2. Create a new table called MyTest:
       Table: MyTest
       ------------------------
       Field Name: MyAutoNumber
          Data Type: AutoNumber 
       Field Name: MyData
          Data Type: Number
       Field Name: MyBucket
          Date Type: Number
    					
  3. Open the MyTest table in Datasheet view and enter a few records by typing numeric values in the MyData field. Note that Microsoft Access automatically fills in the MyAutoNumber field and puts zeroes in the MyBucket field as you type values in the MyData field.
  4. Create a new blank form in Design view based on the MyTest table.
  5. Add a combo box to the form and set the following properties:
       Combo Box:
          ControlSource: MyAutoNumber
          RowSource: MyTest
    					
  6. Switch the form to Form view. Note that the combo box values are the sequential numbers coming from the MyAutoNumber field.
  7. In the combo box list, try to select a new value. Note that you receive message on the status bar, and the value in the combo box does not change.
  8. Switch back to Design view and change the combo box ControlSource property from MyAutoNumber to MyBucket.
  9. Switch back to Form view and repeat step 7. Note that now you can select items from the combo box. If you look at the contents of the table, you can see that the values thatyou selected were written to the MyBucket field.

↑ Back to the top


References

For more information about combo boxes, click Microsoft Access Help on the Help menu, type Combo boxes: What they are and how they work in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

↑ Back to the top


Keywords: KB209681, kbusage, kbprb, kberrmsg

↑ Back to the top

Article Info
Article ID : 209681
Revision : 2
Created on : 7/15/2004
Published on : 7/15/2004
Exists online : False
Views : 350