How to empty a table - delete all records?

W

wdsnews

We're beginning a new school year and I'd like to quickly clear out the
Student Schedule table. It links students to class offerings. Is there an
easy way to delete all records from that table?

thanks.
 
J

Jeanette Cunningham

A simple query can empty a table.
Create a new query in SQL view and type in the following.

DELETE FROM NameOfTable

Either save the query and then run it, or run it and delete it.
Replace NameOfTable with your table name and use brackets if any spaces in
the table name.

If you get a message about not being able to delete the records, it is
probably due to related records in another table/s that need to be deleted
first.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
W

WDSnews

thank you.



Chris O'C via AccessMonster.com said:
If you're sure you don't need those records, run a delete query. (Make a
backup first anyway.)

DELETE *
FROM StudentSchedule

And then compact the db.


Chris
Microsoft MVP
 
W

WDSnews

Thank you.



Jeanette Cunningham said:
A simple query can empty a table.
Create a new query in SQL view and type in the following.

DELETE FROM NameOfTable

Either save the query and then run it, or run it and delete it.
Replace NameOfTable with your table name and use brackets if any spaces in
the table name.

If you get a message about not being able to delete the records, it is
probably due to related records in another table/s that need to be deleted
first.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top