[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How can I reset autonumber of linked table?

Posted on 2009-04-01
5
Medium Priority
?
525 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 1000 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 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
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 …
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…

649 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