Custom autonumber (1 Viewer)

spaLOGICng

Member
Local time
Today, 09:56
Joined
Jul 27, 2012
Messages
127
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: 60
  • 1685798590339.png
    1685798590339.png
    10.3 KB · Views: 48

spaLOGICng

Member
Local time
Today, 09:56
Joined
Jul 27, 2012
Messages
127
Please remember to mark this post as solved so we will stop commenting on it.
 

Users who are viewing this thread

Top Bottom