Custom autonumber

Hi, Hope this helps....

In VBA, this sample sets the Column named "ID" in Table named "Table4" to begin at 10, with increments of 10. The first argument is where it begins, the second argument is the increment.

CurrentDb.Execute "ALTER TABLE [Table4] ALTER COLUMN [ID] COUNTER(10,10)"

In this sample, it will start at 1000, and increment in steps of 2000
CurrentDb.Execute "ALTER TABLE [Table4] ALTER COLUMN [ID] COUNTER(1000,2000)"

You do not need all that fancy VBA. You can get creative, but you should not code more than you need to.


How to restart counting from 1 after erasing table in MS Access? - Stack Overflow
 

Attachments

  • 1685798433245.png
    1685798433245.png
    7.8 KB · Views: 105
  • 1685798590339.png
    1685798590339.png
    10.3 KB · Views: 95
Please remember to mark this post as solved so we will stop commenting on it.
 

Users who are viewing this thread

Back
Top Bottom