Solved

How can I reset autonumber of linked table?

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now