Depends on what you want to do.
i=1 is one way.
If you want to start at 1 every day, and the program will be
shut down and started throughout the day,
then store each number, as it's used, in a system table,
along with the date, and every time you need to generate a
new number, check the date. If the current date is the same
as the entry in the table, increment the number, and then
when the record is saved, put the new number in your system
table. If the date in the system table is not today, start
i at 1.
How do I initialize i?
-----Original Message-----
dim i as integer, s as string
[initialize i, or retrieve it from where it is stored]
If i > 998 Then
Msgbox ("You have exceeded the daily limit of 999
transactions",vbOK)
Else
i = i + 1
s = Format(Date, "yyyymmdd") & Format(i, "000")
End If
shaggles said:
Is it possible to generate numbers that starts with the
current month and year and then adds 001, 002,etc.? I
want to end up with something that looks like
200407001.
.