Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What can I use besides AutoNumber

Replacing AutoNumber

What can I use besides AutoNumber

by  mac318  Posted    (Edited  )
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.

mac318
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top