delete * from tables?

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.
dkim18Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
wshark83Connect With a Mentor Commented:
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
 
CluskittConnect With a Mentor Commented:
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
 
Dale FyeConnect With a Mentor Commented:
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
 
VBClassicGuyConnect With a Mentor Commented:
If you must compact the database, use this:

http://support.microsoft.com/kb/273956
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.