Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Control can't be edited - bound to an AutoNumber Field 1

Status
Not open for further replies.

srogers

Technical User
Aug 15, 2000
201
US
I have a form bound to a query.

One table in the query has an autonumber CategoryID and a text category name.

A combo box on the form displays the choices in the table when you click the drop-down arrow. But when you click on one of the choices I get an error that says "Control can't be edited, its bound to Autonumber field CategoryID".

When I look at the properties on the combo box the rowsource is: SELECT DISTINCTROW Categories.* FROM Categories ORDER BY [Categories].[CategoryName];

Where else can I look to find the problem?
Thank you -
 
Sounds like a 'bound column' problem. Look at the combo box's 'bound column' property and see if it corresponds to the autonumber column.

EIther rearrange the columns in the SQL statement or change the bound column number.

Remember that in Access, column numbering begins with 1, while in VBA it begins with 0.

Cheers,
Bill
 
Additionally, I think you are trying to use this Bound Combobox to select another record to be displayed. Is this correct? If it is ACCESS thinks that you are changing the value of the Bound Field because you are assigning a new value to the Bound control(combobox). If you want the combobox to be used to select another record then delete the combobox and use the Combobox Wizard to create a control that perfomrs that function. Just follow the steps for the selection "Find a record on my form based on the value I selected in my combobox".

Good luck.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
Bob,
I don't want to find a record based on the value in the combobox because many records might have that value.

If the choices are dog, cat, rabbit, I want to choose one of those and be able to use it later to sort or group by. The question I got stuck on in the combo box wizard was if I wanted to store it and then I had to choose where to store it. So I guess I need a table to use with the combo box to look up items and then a field in another table where I will store the item chosen. So I guess that means I need to add a field to an existing table.

Does that sound right?
Thanks -
 
The problem is you have a Bound form. That means that most of the controls on your form are filled with data from the underlying table/query. This includes your combobox. Look at the property ControlSource for the combobox. It will be the AutoNumber field from your table. When let's say you have a particular record showing in your form and you attempt to make a choice from this combobox "ACCESS INTERPRETS THIS AS CHANGING THE RECORDS AUTONUMBER". This absolutely can't be done. You see the autonumber field is controlled by ACCESS and is assigned to each record forever. No changes allowed.

By using the ComboBox Wizard you can select an option to use the combobox to find and search for particular records. You haven't done this but you have set the ControlSource to a field from the Bound field list.

And yes you can have a lookup table or you can use a ValueList if the list is relatively small and unchanging. Look at the RowSourceType. Check ACCESS help on how to use this type of RowSource in a combobox.

Post back with any questions.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top