Solved

delete * from tables?

Posted on 2012-03-23
4
473 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

919 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

16 Experts available now in Live!

Get 1:1 Help Now