From the messagebox that appears when you try to change a data type with
data in it (duplicate or not) to Autonumber:
"Once you enter data in a table, you can't change the type of any field to
AutoNumber, even if you haven't yet added data to that field.
Add a new field to the table and define its data type as AutoNumber.
Microsoft Access then enters data in the AutoNumber field automatically,
numbering the records consecutively starting with 1."
To put predefined numbers in an AutoNumber field, you have to create a new
table with the AutoNumber field to correspond to a Long Integer field in the
original, and other fields of the same type as the original -- then append
the information from the original.
From your description, I am not quite certain just what you mean by "add an
autoincrementing id to a table based on an
existing field Name". One thing... "Name" isn't a good field name because it
is an Access reserved word and sooner or later it'll cause you trouble.
Second, I'd figure that to be a Text field not a Long, so you need to
clarify.
I'm not at all sure I understand why you want to do what you describe, if
there would be duplicate numbers in that field, because the purpose of an
AutoNumber is to provide a unique identification for records just for
internal use in your application... e.g., joining related tables.
However, a field defined as AutoNumber can have data appended that results
in duplicate numbers in the field, provided you haven't set it as a primary
key, or set its properties to disallow duplicates.
Larry Linson
Microsoft Access MVP
"Amy" <ww**@shaw.ca> wrote in message
news:6c**************************@posting.google.c om...
I'm trying to add an autoincrementing id to a table based on an
existing field Name, but Name has duplicated records. How can I do
that in ACCESS?
Thanks.
Amy