Solved

How can I reset autonumber of linked table?

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

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…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

730 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