Public Function Invoice() As String Invoice = Format(Date, "yymmdd") & Format(Time, "hhmmss") End Function
Although I call this function from a class module, it will work as well behind a form or standard module. I use it to generate a unique invoice number; however, it can be used to generate a unique record key for any purpose. The trick is to carry the time out to hundreds of a second. A 12 character text field holds the output of the function.
The best part, by setting this as a Primary Key, it can't be changed. The date the record was created will exist as long as the record.