Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 13th, 2005, 12:10 AM
Cillies
Guest
 
Posts: n/a
Default Reset Autonumber

Hello, I was wondering if anyone knew how to reset an auto number.

I.E.
in my database I have two tables with autonumbers as primary keys. So
I was wondering if anyone knew an easy way of resetting them, as I
have made a few errors throughout the database.

Kindest Regards
  #2  
Old November 13th, 2005, 12:10 AM
fredg
Guest
 
Posts: n/a
Default Re: Reset Autonumber

On 28 May 2004 08:50:06 -0700, Cillies wrote:
[color=blue]
> Hello, I was wondering if anyone knew how to reset an auto number.
>
> I.E.
> in my database I have two tables with autonumbers as primary keys. So
> I was wondering if anyone knew an easy way of resetting them, as I
> have made a few errors throughout the database.
>
> Kindest Regards[/color]

You can reset the autonumber field to 0 by first deleting all the data
in the table. NOT the table itself, then compacting the database.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
  #3  
Old November 13th, 2005, 12:13 AM
devdex.com
Guest
 
Posts: n/a
Default Re: Reset Autonumber

Hi thanks for the advice, but is there any way of doing it without
deleting all the data in the table.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4  
Old November 13th, 2005, 12:13 AM
Stewart Allen
Guest
 
Posts: n/a
Default Re: Reset Autonumber

Create a new table with identical field structure. Create an Append query
using the old table as its record source and use the new table as the target
and match every field except the autonumber fields. Run the query and then
rename and/or delete the appropriate tables.

This will not work if there's a relationship from the Autonumber field
linked to a field in another table. Why do you really want to reset the
Autonumber back to zero if you want to keep the data?

Another way I've done it but not for any client of mine is to delete the
Autonumber field, save the table and then re-create the field again. If the
table has 500 records they will automatically have the numbers 1 to 500.

Before doing these operations, ***Back Up*** first.

Stewart


"devdex.com" <anonymous@devdex.com> wrote in message
news:40bc4bb7$0$205$75868355@news.frii.net...[color=blue]
> Hi thanks for the advice, but is there any way of doing it without
> deleting all the data in the table.
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it![/color]


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles