RonMcIntire
Technical User
All:
I'm trying to delete the data from a table and reset the autonumber index back to 1 but I'm having trouble.
Everything I read says I can use ALTER TABLE to do it but it doesn't seem to work for me.
Here's my code:
Private Sub nResetCtlNo_Click()
Dim SQL_Text As String
'Delete the data from table tblSVOrders
DoCmd.RunSQL "Delete*from tblSVOrders"
'Drop the index from the table
DoCmd.RunSQL "ALTAR TABLE tblSVOrders DROP COLUMN CtlNo"
'Add a new index column to the table
DoCmd.RunSQL "ALTAR TABLE tblSVOrders ADD COLUMN _ CtlNo autonumber"
End Sub
I keep getting the error "Invalid SQL statement. Expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.
What am I doing wrong?
Appreciate all the help I can get.
Ron
I'm trying to delete the data from a table and reset the autonumber index back to 1 but I'm having trouble.
Everything I read says I can use ALTER TABLE to do it but it doesn't seem to work for me.
Here's my code:
Private Sub nResetCtlNo_Click()
Dim SQL_Text As String
'Delete the data from table tblSVOrders
DoCmd.RunSQL "Delete*from tblSVOrders"
'Drop the index from the table
DoCmd.RunSQL "ALTAR TABLE tblSVOrders DROP COLUMN CtlNo"
'Add a new index column to the table
DoCmd.RunSQL "ALTAR TABLE tblSVOrders ADD COLUMN _ CtlNo autonumber"
End Sub
I keep getting the error "Invalid SQL statement. Expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.
What am I doing wrong?
Appreciate all the help I can get.
Ron