simbamfalme
Registered User.
- Local time
- Today, 03:06
- Joined
- May 23, 2012
- Messages
- 12
Hi Guys. I am preparing a database that stores the records of runners such as their results, the runs they take part in, the locations where the runs take part, etc. One of the requirements is to have a the RunID as the first 3 letters of the LocationName, and then a sequential number which is higher than the one currently in use.
For example, if there is a run at location Liverpool, and the current sequential number is 15, the new RunId should be liv16
I have managed to use this:
=Left([LocationName],3) & DMax("Right([Run]![RunID],2)","Run")+1
However, the problem that i am having at this point is if the sequential number is a one digit number, such as 2, and the latest RunID is wes01, then the new RunID for location Liverpool returns Liv2, intead of Liv02, which is a problem since the next RunId cannot be generated, as it tries to add v2 +1 instead of 02+1 as my formula checks the last 2 characters of the previous RunID. A similar error would occur if the sequential number reaches more than 99, if you understand what i mean.
I need a way to get around this. Please guys help me out.
Thanks
For example, if there is a run at location Liverpool, and the current sequential number is 15, the new RunId should be liv16
I have managed to use this:
=Left([LocationName],3) & DMax("Right([Run]![RunID],2)","Run")+1
However, the problem that i am having at this point is if the sequential number is a one digit number, such as 2, and the latest RunID is wes01, then the new RunID for location Liverpool returns Liv2, intead of Liv02, which is a problem since the next RunId cannot be generated, as it tries to add v2 +1 instead of 02+1 as my formula checks the last 2 characters of the previous RunID. A similar error would occur if the sequential number reaches more than 99, if you understand what i mean.
I need a way to get around this. Please guys help me out.
Thanks