access 2007 vba using chr()
Posted on 2010-08-24
I am working on a function to automatically create a lot number.
This is the format: GAA0001
It first gets the last lot number used from the table.
Then look at the numeric section to see if it is at 9999.
If so, it needs to look increment the 3rd letter. If the 3rd letter is Z, it should set it to A and increment the 2nd letter.
I know that chr(65) is "A" and chr(90) is Z
Is there a way to work on the 3rd letter like this?
strCharacters = "GAA1234"
strLetter = mid(strCharacters, 3)
if strLetter is greater than chr(90) then
strLetter = chr(65)
Then I'll go on to look at and increment the 2nd letter if needed.
I know I have data type mismatches in there... that is what I'm trying work around.