[quote=338062:@Steve Kelepouris]As an addition to this, I think it’s worth noting that the code can be changed to ONLY show the last 4 digits (or whatever number). The numbers are truncated at left. Therefore 1234567 becomes 4567, or in this case TEST4567 :
TEST + Right(Format(myInteger, "0000"),4)
As it is, for my purposes, the original code works fine. Over 9999 - then it shows 10000, and so it should.
The reason I wanted to know how to do this, is because I want my saved filenames to be preceded by: TEST0001, TEST0002 etc. That way, the user can view the files by name and therefore chronologically without relying on an internal date/time stamp.
It’s also far easier to review files this way because my software is used for recording analytical tests and therefore a number is more appropriate and easier to deal with, in the majority of cases.
Ultimately this is the type of filename I’m talking about:
TEST0007_TESTNAME_Wed, 28 Jun 2017 @ 7.37 PM
Also, it’s important to mention that the filename is automatically created, ie. no user intervention, no save dialog box. The user can enter a TESTNAME, but that’s all.
It may seem insane, complicated, bad programming, unnecessary or ALL of those but really simple if you know why.
I’d think you’d name them
TESTNAME_TEST0007_Wed, 28 Jun 2017 @ 7.37 PM
so they all group together by test name
Say a user did 4 or 5 different runs of tests and they each had several tests then you end up with files group together like
TEST0001_BAR_Wed, 28 Jun 2017 @ 7.37 PM
TEST0001_FOO_Wed, 28 Jun 2017 @ 7.37 PM
TEST0001_TESTNAME_Wed, 28 Jun 2017 @ 7.37 PM
TEST0002_BAR_Wed, 28 Jun 2017 @ 7.37 PM
TEST0002_FOO_Wed, 28 Jun 2017 @ 7.37 PM
TEST0002_TESTNAME_Wed, 28 Jun 2017 @ 7.37 PM
but if you named them by the users testname first then you’d get
BAR_TEST0001_Wed, 28 Jun 2017 @ 7.37 PM
BAR_TEST0002_Wed, 28 Jun 2017 @ 7.37 PM
FOO_TEST0001_Wed, 28 Jun 2017 @ 7.37 PM
FOO_TEST0002_Wed, 28 Jun 2017 @ 7.37 PM
TESTNAME_TEST0001_Wed, 28 Jun 2017 @ 7.37 PM
TESTNAME_TEST0002_Wed, 28 Jun 2017 @ 7.37 PM