Results 1 to 5 of 5
  1. #1
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727

    reset autonumber


    All; I have some code to delete all data from a table, then reload it with an append query. Is there a way to reset the autonumber of the table I am adding the data to when it is empty? Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Bing: Access reset autonumber

    http://support.microsoft.com/kb/812718
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    I'm trying to do this during executing my code after I delete the data from this table:

    Code:
    Dim strSql As String
    strSql = "ALTER TABLE tblMstr ALTER COLUMN ID1 COUNTER(1,1)"
    DoCmd.RunSQL strSql
    I get invalid field type.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    That doesn't appear to be what is described in the link. I doubt can do this with ALTER sql.

    Run Compact & Repair to reset empty table autonumber.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Here's a link to two methods:

    http://access.mvps.org/access/tables/tbl0005.htm

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Reset autonumber field and delete records?
    By clebergyn in forum Programming
    Replies: 7
    Last Post: 02-20-2014, 07:32 PM
  2. Replies: 2
    Last Post: 12-04-2013, 08:09 PM
  3. AutoNumber reset
    By Seeletse in forum Access
    Replies: 3
    Last Post: 12-12-2012, 07:14 AM
  4. Reset autonumber in a concatenate field
    By Fish218 in forum Forms
    Replies: 6
    Last Post: 03-13-2012, 11:58 AM
  5. Query to Reset AutoNumber to 1 after full delete
    By saigovind in forum Queries
    Replies: 1
    Last Post: 02-04-2011, 03:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums