Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

delete * from tables?

Posted on 2012-03-23
4
Medium Priority
?
482 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 200 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 1400 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 49

Assisted Solution

by:Dale Fye
Dale Fye earned 200 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 200 total points
ID: 37758590
If you must compact the database, use this:

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

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

810 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