• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 484
  • Last Modified:

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.
0
dkim18
Asked:
dkim18
4 Solutions
 
CluskittCommented:
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
 
wshark83Commented:
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
 
Dale FyeCommented:
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
 
VBClassicGuyCommented:
If you must compact the database, use this:

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

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now