I know this is marked as resolved, but I thought I'd chime in.

In terms of reliability (and your time to get it working), AutoNumber is the better option.

I've seen several people make attempts at creating their own version, and in each case there has always been at least one situation where it failed (or would have given enough time), such as multiple new records being created 'simultaneously' by different users.

There are a surprising number of situations that need to be thought of carefully before creating something like that, and it has already been done properly (and tested by millions of people) in AutoNumber.


As Hack posted, the downside to AutoNumber is the lack of consecutive numbering... but that is actually a good thing in terms of the database (as it means any 'orphan' data in other tables wont get linked to a new record). If you need consecutive numbering, I would recommend thinking of using another field for that purpose.