Results 1 to 5 of 5
  1. #1
    Cran29 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    38

    Erasing all data

    I know this may horrify everyone and questions may be asked. How do I delete all records from my Data base and resume it to an empty state leaving the tables queries codes unharmed everything still functional. Starting from total empty of data

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Check out the scripts in this thread here: http://stackoverflow.com/questions/6...tables-at-once

    You want to be careful not to delete the data in the hidden system tables, or that could really mess things up!
    Also, you will want to be sure to do a Compact & Repair after your deletion to keep the database from bloating (records really are not removed from the DB until you do this step, so the size will not decrease until you do this).

  3. #3
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Create a new database and import everything that you want. Make copies of the tables first, "Structure Only"

  4. #4
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    If you have relationship with cascading Deletes, might only have to delete records from main table. But could use some delete queries or SQL in code:

    Maybe sure you have a good backup of the data if needed before testing.

    OnClick event on a button maybe(change names to your tables):

    Docmd.SetWarnings False
    DoCmd.RunSQL "Delete * from Table1"
    DoCmd.RunSQL "Delete * from Table2"
    Docmd.SetWarnings True

  5. #5
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Create a new database and import everything that you want. Make copies of the tables first, "Structure Only"
    If it is just a one-time thing, I agree that this method is probably the safest and cleanest way. Importing to a new database is also a popular method of correcting corruption issues.

    Just a few things to note if you do use this method. Be sure to include all your other Objects in your import (Queries, Reports, and Forms), and you may need to click on the Advanced Options to include things like Import Specifications and Relationships, if you use any of those things. And if you use a Startup Form, that setting will not transfer over, you will need to re-select that in your new db (no big deal).

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

Similar Threads

  1. Replies: 9
    Last Post: 03-01-2017, 10:00 AM
  2. Replies: 10
    Last Post: 09-29-2016, 08:00 PM
  3. Replies: 2
    Last Post: 06-11-2015, 10:22 AM
  4. Replies: 2
    Last Post: 10-15-2013, 09:30 AM
  5. Replies: 1
    Last Post: 12-21-2011, 02:11 PM

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