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.
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.
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
Instead of deleting all rows, you can drop the table and create it again. It's not very effective nor clean, but it'll reset the autonumber count.