Solved

How can I reset autonumber of linked table?

Posted on 2009-04-01
5
516 Views
Last Modified: 2012-05-06
I have this:

strSQL = "ALTER TABLE Extracted_NDW_WEEKLY_PRODUCT_MOVEMENT ALTER COLUMN [Auto_ID] COUNTER (10,1); "
CurrentDb.Execute (strSQL)

Thanks
0
Comment
Question by:indyng
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 24038761
If this is a access db, only way I know how to reset autonumber is to empty table then do a compact/repair.

Is this backend msacceess or some other db
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 24038784
ok, your sql will work but unless the table is empty, you run the risk of failing records due to duplicate records

as you cant do this on linked tables, only other way I can think of is if you open the access database via vba then run the sql



0
 
LVL 65

Accepted Solution

by:
rockiroads earned 250 total points
ID: 24038808
eg

    Dim dbData As dao.Database
   
    Set dbData = DBEngine.Workspaces(0).openDatabase("c:\mydb.mdb", False, False, "")
    dbData.Execute "your sql"
   
    dbData.Close

0
 
LVL 28

Assisted Solution

by:TextReport
TextReport earned 250 total points
ID: 24038942
The sql to reset the AutoNumber field is below and you can run this as suggested by rockiroads above in ID:24038808

ALTER TABLE tblTest ALTER myAutonumberField AUTOINCREMENT(1,1)

Cheers, Andrew
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question