theorize99
theorize99

Reputation: 67

Control cannot be edited; it's bound to AutoNumber field

I see others have asked about this error, but being such a novice, I'm still not able to figure out why it's happening in this project. Hoping someone can take a look and tell me what I'm doing wrong...

In 'formEmployeeFile', the data in combobox 'cboPosition' cannot be modified. I receive the error, "Control cannot be edited; it's bound to AutoNumber field 'PositionCID'."

Upon opening the employee file in formEmployeeFile, the combobox 'cboPosition' should display the 'PositionName' assigned to that employee. The drop-down list should contain all of the possible positions, which are contained in 'tablePositionCatalog'. I've just barely figured out a way to do both, but I'm still stuck with the error I described above.

This project is far from finished, and this is literally my first attempt at a database, so please forgive its rough shape! Oh, and though it may look real, the data (e.g. employee names, phone numbers) currently inside this file is fake.

Employee Database

Upvotes: 1

Views: 1347

Answers (1)

June7
June7

Reputation: 21389

With current structure of complex RecordSource, cboPosition should just be a textbox bound to PositionName field. This textbox properties should be Locked Yes and TabStop No to prevent editing.

This is peril of having exact same field name in multiple tables. Your queries carry PositionCID autonumber field forward and that is field you try to bind to and edit. Instead you need PositionCID foreign key field from tableEmployeePositions. Have to modify queries.

If tableEmployees and tableEmployeePositions have a 1-to-1 relationship, should just be 1 table. A 1-to-1 relationship is an exception to 1 form for 1 table editing but this relationship is rarely needed. You could just simplify and combine the tables - unless you need to track history of employee positions. In which case you could not include tableEmployeePositions in form RecordSource since there could be multiple records for each employee and this would be a many-to-many relationship.

Upvotes: 1

Related Questions