Solved

How can I reset autonumber of linked table?

Posted on 2009-04-01
5
506 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
  • 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

778 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