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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resetting Autonumber

Status
Not open for further replies.

soulfunkuk

IS-IT--Management
Sep 1, 2005
13
GB
Is there anyway of reseting an autonumber field to 1, without deleting and then recreating the table it is in??

For example if you wanted to enter test data and then clear all data out?

Cheers

Keith
 
I think this covers all the options:
Reset Autonumber Field
thread702-1050735
 
So is this some visual basic code or in properties?
 
The thread shows two options
ZmrAbdulla offers a 'no coding' solution. That is, clear the table then choose Compact and Repair.

flyover789 offers some neat coding that can be placed in a module.

If you wish to regularly test and restart, option 2 is probably your best choice. If it is a once or twice thing, option one will be fine.

So the answer to you question is, in a way, both! :)
 
Resetting Autonumber with linked tables by autonumber will be taking you into trouble..

________________________________________________________
Zameer Abdulla
Help to find Missing people
You may be the boss' pet; but you are still an animal
 
reseting an autonumber field to 1
CurrentDB.Execute "ALTER TABLE yourTable ALTER COLUMN myID COUNTER(1,1)"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Could you delete all the links, reset or compact repair, and then put the links back in?? Would this be safe?

Cheers for the help
 
soulfunkuk said:
Could you delete all the links, reset or compact repair, and then put the links back in?? Would this be safe?
I am not the one who will be able to answer this..

________________________________________________________
Zameer Abdulla
Help to find Missing people
You may be the boss' pet; but you are still an animal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top