Solved

delete * from tables?

Posted on 2012-03-23
4
476 Views
Last Modified: 2012-03-23
Is there a simple to delete every records from multiple tables?
Then I need to compact the database to recreate the auto number start from 1.
0
Comment
Question by:dkim18
[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
4 Comments
 
LVL 18

Assisted Solution

by:Cluskitt
Cluskitt earned 50 total points
ID: 37757841
Select all the tables you want to delete, copy then with "Structure only" option (no data), delete the original ones, rename the new ones (easy to delete the "copy of" part)
0
 
LVL 6

Accepted Solution

by:
wshark83 earned 350 total points
ID: 37757869
you can have multiple statements as per below :

DoCmd.RunSQL ("Delete * from <tablename1>")
DoCmd.RunSQL ("Delete * from <tablename2>")
DoCmd.RunSQL ("Delete * from <tablename3>")
DoCmd.RunSQL ("Delete * from <tablename4>")

this is quicker in deleted all the rows from the table and keeps the table structure intact
0
 
LVL 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 50 total points
ID: 37758001
Running the delete query will not restart the autonumbers from scratch, Cluskitt's method will do this for you.

But I would argue that this is a waste of time.  Autonumber ID fields should not be visible to your users anyway, so restarting from 1 is not necessary.  If you need to display a field to users that starts at one, use a numeric value that you can manipulate the way you want to.
0
 
LVL 14

Assisted Solution

by:VBClassicGuy
VBClassicGuy earned 50 total points
ID: 37758590
If you must compact the database, use this:

http://support.microsoft.com/kb/273956
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

726 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