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.
我的建议是不要太担心重新播种自动编号。让 Access 保持其独特性。如果您需要重置它,请查看其他人发布的评论。
关于修复您的实际错误,您实际上并没有在上面运行任何东西。如果你想运行一条 SQL 语句,你可以使用CurrentDb.Execute
或类似这样的东西:
Private Sub Command12_Click()
CurrentDb.Execute "DELETE FROM a_test"
End Sub
您可以删除表并重新创建它,而不是删除所有行。它不是很有效也不干净,但它会重置自动编号计数。