VB code logic
Posted on 2014-04-29
I'm creating a simple VB project which will run in the System Tray and will allow the user to generate an Account Number for new accounts.
The format of the account number will be TR000000
The first two letters will always be TR
The first two numbers will be the last two digits of the current year
The next two digits will be the current Month
The final two digits will be a consecutive number from 01-99
So if a user generates an account number on May 01 2014 the number will be:
If another account number is generated on the following day it will be:
TR140502 & TR140503 & TR140504 etc, etc
On June 01 2014 the number would be:
TR140601 and so on.
I'm trying to get my head around how to generate the number accordingly. I can sort of work out the Year and the Date section of it, but I'm stuck on the consecutive number. How would I ensure that at the start of a new month the last two number of the account number would reset back to 01 and start all over again?
I'm planning on using an .ini file to store the currently generated number, but that's all I've got.
Hope someone can help me out with this.