To restart from 1 primary key auto incriment column MSAccess 20

  • Thread starter Thread starter pol
  • Start date Start date
P

pol

Hi all,

How I can initialise primary key auto incriment number in MSAccess 2007. I
want to restart from 1 . Please advice me
 
pol said:
How I can initialise primary key auto incriment number in MSAccess 2007.
I want to restart from 1.

Steps:
1. Delete any existing records in the table.

2. Compact the database. (Office button | Manage.)
 
Pol,

In addition to what Allen said, if you *care* about the value in Autonumber
then perhaps it's not the field for you. If you delete a record between 1
and 3, you will not get to REuse 2. You can create your own *Autonumber* by
using the DMax function and placing it on the Before_Update event of your
form.

=DMax("YourAutonumberField","YourTable")+1

There are also way to *recover* lost numbers and REuse those values.

SELECT T.YourAutonumberField+1 AS Missing
FROM YourTableAS T LEFT JOIN YourTableAS T1 ON
T1.YourAutonumberField=T.YourAutonumberField+1
WHERE (((T1.YourAutonumberField) Is Null));

Good Luck!
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm
 
Back
Top