Pat:
1. From the database window copy the table to the clipboard.
2. Paste it back as a new table under a different name, electing to paste
'structure only.
3. Create an append query which appends all fields from the old table to
the new one APART FROM the autonumber primary key field.
The new table should now have all the old one's data with primary key values
starting from 1. You can then delete the old table and rename the new one to
the old one's name.
OK, so that's how to do it, but why should you? Autonumbers are to
guarantee uniqueness not sequence and the values are arbitrary, having no
intrinsic meaning, so where they start from and any gaps in the sequence are
immaterial. Also, if there other tables which reference the primary key of
table in relationships the values of the foreign keys fields in the
referencing tables would no longer map to the correct rows in the new table.
If there is a real need for sequential numbering then you should generate the
numbers in a straightforward long integer number field. I've posted a demo
of how to do this at:
http://community.netscape.com/n/pfx...yMessages&tsn=1&tid=23839&webtag=ws-msdevapps
The demo also prevents any conflicts in a multi-user environment on a
network, where two users might be adding records simultaneously and thus
would otherwise generate the same number for different records, violating the
key. It does this by means of the commonly used technique of storing the
last number in a separate database in a shared folder on the server, normally
the same folder as the back end data file of the application. This is opened
exclusively in code to get the next number, thus preventing any conflicts.
The starting point for the next number can be reset at any number greater
than the highest number already in the table.
Note that this method of generating a 'pseudo autonumber' is designed for
situations where records are entered one at a time via a form, not for bulk
inserts via an 'append' query. For bulk inserts you'd need to add one record
at a time in a loop, calling the code to generate the next number each time.
Ken Sheridan
Stafford, England