473,326 Members | 2,110 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Q: Autoincrement Seed

Hi

I'm trying to delete all the records in an Access database and then add in
new rows. This I have done. However, the primary key values don't re-start
at 1 but instead continue from the last value when the table was full.

Is there a way I can re-set the primary key starting value?

Thanks in advance

Geoff
Nov 21 '05 #1
2 1331
The only way I know of to accomplish that would be to remove the primary key
field from the Access table, then add a new field with the same name and in
the same position. Then set the data type to AutoNumber. If there would
ever be any existing rows when you would do that, the primary key values
would be re-assigned for those rows, starting with 1... Something to
consider if existing records are linked to other tables. But you say you
delete all rows, so that should not be a problem.

www.charlesfarriersoftware.com
"Geoff Jones" wrote:
Hi

I'm trying to delete all the records in an Access database and then add in
new rows. This I have done. However, the primary key values don't re-start
at 1 but instead continue from the last value when the table was full.

Is there a way I can re-set the primary key starting value?

Thanks in advance

Geoff

Nov 21 '05 #2
If you compact the table, the auto will return to 1.

--

Bob

--------------------------------------
I'll have a B please Bob.

"Charlie" <cfarrier at charlesfarriersoftware.com> wrote in message
news:8C**********************************@microsof t.com...
The only way I know of to accomplish that would be to remove the primary
key
field from the Access table, then add a new field with the same name and
in
the same position. Then set the data type to AutoNumber. If there would
ever be any existing rows when you would do that, the primary key values
would be re-assigned for those rows, starting with 1... Something to
consider if existing records are linked to other tables. But you say you
delete all rows, so that should not be a problem.

www.charlesfarriersoftware.com
"Geoff Jones" wrote:
Hi

I'm trying to delete all the records in an Access database and then add
in
new rows. This I have done. However, the primary key values don't
re-start
at 1 but instead continue from the last value when the table was full.

Is there a way I can re-set the primary key starting value?

Thanks in advance

Geoff

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: jaYPee | last post by:
I have a table in my sqlserver 2000 that has a field IDNO. i want this field to be my primary key. however i don't want this field to use the autoincrement feature. when i access this table from...
0
by: Neil | last post by:
Hi, I'm getting some strange results using the autoincrement column on my datatable. I'm populating a datatable with data from my database and displaying this in a datagrid. The first time I get...
6
by: Dennis | last post by:
I have set a DataTable and one of the columns I set "AutoIncrement" to True. I then populate the Table by setting the columns to values then add the row to the table. I inadverently set the...
1
by: Sam | last post by:
Hi all I have a simple datagrid form which has 4 columns. The first one is used just like a key and the other threes allow user to enter numbers. The problem that I am having is that when I...
1
by: Aaron Smith | last post by:
I have a parent table that has one child table. The parent has a single field (ID, AutoIncrement, Seed 0, Step -1 in the DataSet, Seed 1, step 1, in DataSource). The child is linked to this ID...
6
by: Michael | last post by:
I am trying to create an access database within Net 2003 using the ADOX library which works fine except when I try to add the AutoIncrement property to the ContactId column. I am experiencing a...
5
by: JC Voon | last post by:
Hi: How to reset the autoincrement value generated by DataTable ? I've master and detail table, the detail table has a autoincrement column, each time i add a new master record, i need to...
3
by: MP | last post by:
context: vb6/ ado / .mdb format / jet 4.0 (not using Access - ADO only) - creating tables via ADO (don't have access) - all tables have a primary key (PK) - many of the PK will become FK(Foreign...
4
by: Tim | last post by:
Hello All, I could use some help on an error that is just now popping it's head up. Seems that the autoincrement numeric has hit 32,767. The autoincrement is used in various locations in the...
1
rizwan6feb
by: rizwan6feb | last post by:
I have a DataTable with thousands of records, i want to show these records on per page basis ( i.e a DataGridView showing first 20 records and next button to show next 20 records ...) To achieve...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.