To restart from 1 primary key auto incriment column MSAccess 20

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
 
A

Allen Browne

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.)
 
G

Gina Whipp

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top