How do I make a customized Primary ID in MS Access?
I would like to create a customized primary ID in MS access in that format : Year+ autonumer, for example (200900000001). It starts with 00000001, and when the year in the system clock changes, then it reset the number again (201000000001).
You won’t be able to customise the autonunber in Access. The format is controlled by MS Access.
If you are interested in when the data was entered then you should store the year as a column in the table.
You can add another column in the table and then set the default value to be =year(date())
you need to check the syntax but that should store the year value when a new record is inserted.
This is a better way of storing the year.
Making the change at a database level will ensure the value gets recorded if the user inserts a value using a form or an insert command
February 8th, 2010 at 12:02 pm
You won’t be able to customise the autonunber in Access. The format is controlled by MS Access.
If you are interested in when the data was entered then you should store the year as a column in the table.
You can add another column in the table and then set the default value to be =year(date())
you need to check the syntax but that should store the year value when a new record is inserted.
This is a better way of storing the year.
Making the change at a database level will ensure the value gets recorded if the user inserts a value using a form or an insert command
References :
Too many years developing database solutions
February 8th, 2010 at 12:38 pm
You can’t do exactly what you are asking for.
What you can do is use the format property in your form for that field to disguise how it looks. You can make it look like 200900000001 on the form, but it will always get saved to the table as a plain autonumber.
For FREE Access ebook and videos click here
http://access-databases.com/ebook
References :