when i click on command button, i need to crete a unique IDNAME...
For example, based time value:
IDNAME="09082021135228"
currdatehhmmss
Peraphs is one of my first question, about 15 year old
create a unique id with year, month, day, hh,mm,ss
-
- PlatinumLounger
- Posts: 4355
- Joined: 26 Apr 2010, 17:36
-
- Administrator
- Posts: 78481
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: create a unique id with year, month, day, hh,mm,ss
That would be
but I would prefer
because that would make it easy to sort the IDNAME values.
Code: Select all
IDNAME = Format(Now, "mmddyyyyhhnnss")
Code: Select all
IDNAME = Format(Now, "yyyymmddhhnnss")
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4355
- Joined: 26 Apr 2010, 17:36
Re: create a unique id with year, month, day, hh,mm,ss
TKS!HansV wrote: ↑08 Sep 2021, 12:36That would be
but I would preferCode: Select all
IDNAME = Format(Now, "mmddyyyyhhnnss")
because that would make it easy to sort the IDNAME values.Code: Select all
IDNAME = Format(Now, "yyyymmddhhnnss")
I choose the second, because is a good tips!
-
- 4StarLounger
- Posts: 550
- Joined: 27 Jun 2021, 10:46
Re: create a unique id with year, month, day, hh,mm,ss
Of course, you need to make sure that at least 1 second has elapsed between ID assignments ...