Is there any way to create a button which basically clears a entire table in your database?

I was hoping to have 2 buttons, 1 to empty a table 1 to fill the same table again.
The idea is to store a year long values, and at the end of the year delete all of those with a button.
The other button i want to use to fill the same table again.
Starting from 1st day of the year untill the last day of the year.
So add a record for each day.

Found some examples, but those did not apear to work in VB2010 anymore.

Do you have a method to connect to the access database?

If not, you will have to:

1) Connect to the database (Use this for your connection string)
2) Create a new command (Use this for a simple guide on connecting to the database.)
3) Execute the command. (Use the string below to delete.)

Try something like this:

Dim sqls As String = "DELETE FROM table"

Yeah the database is shown on a form already.
The connection is done through Data sources.

What are you using for a data source? ADO?

A much faster way to delete all records is "TRUNCATE TABLE tablename"

commented: I didn't know this existed. Thanks Rev +5


i thought Truncate table only worked for SQL DB's?