Question Locked

Auto Assign a Unique ID in MS Access

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

When a record is first added to this particular database I?m working on, I would like a record to be automatically assigned the current date (e.g. 22-Jul-09) in a separate field. I also would like to be able to automatically assign each record with a unique alphanumeric identifier (e.g. KARL090722) when a record is first created. The first 4 alpha characters are pre-defined in a field of their own and ideally, the 6-digit numeric part is a date identifier as to when the record was created.

I would appreciate any suggestions as to how to go about accomplishing this. I would also settle for some alternative in automatically assigning some kind of unique alphanumeric identifier.

Thanks for the help.

2 replies

by tony hopkinson

of Today() ,GetDate(), Now() ???
How can that identifier be considered unique, what stops you adding two KARL's in one day?

Personally I'd just add an identity column if there's no other key and then when I needed the 'UniqueID', just Query it out with a select statement, intelligent identifiers usually turn out to be real dumb in my experience.

Can't see anyway of doing waht you describe except in code through say a form with a BeforePost event handler or some such.

This discussion is closed to new replies.