Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete all table entries in sql [duplicate]

Is it possible delete all entries in a table and reset the autonumber count?
I have tried:

Private Sub Command12_Click()
DELETE FROM a_test
End Sub

But it I get an error "Expected end of statement". I am using Access 2010.

like image 921
BigApeWhat Avatar asked Apr 27 '26 00:04

BigApeWhat


1 Answers

My advice is not to worry so much about reseeding the autonumber. Let Access maintain it's uniqueness. If you need to reset it, look at the comments others have posted.

In regards to fixing your actual error, you're not actually running anything above. If you want to run a SQL statement, you can use CurrentDb.Execute or something like this:

Private Sub Command12_Click()
    CurrentDb.Execute "DELETE FROM a_test"
End Sub
like image 178
sgeddes Avatar answered Apr 29 '26 14:04

sgeddes