Kaway Posted January 23, 2015 Share Posted January 23, 2015 [HIDE-THANKS]It is sometimes desirable to generate a string analogous to the autonumber, that is, to have a way of "incrementing" a text string. This might be useful if, for instance, you have a database field that (a) is textual, (b) has to be unique, and © has to be generated programmatically as you add a new record. The following function accepts a string and returns the one that "comes next", as is illustrated in the following table: If you pass in The function will return ABC ABD ABY ABZ ABZ ACA AZZ BAA ZZZ AAAA In other words, it will work just as you would expect it to for a numeric argument, incrementing the last position if possible or resetting it to A and incrementing the one to its left. The suggested function is case-insensitive; it will preserve the case used in the original string. Sample use: Text1.text = IncrementTextString(Text1.text) This is the hidden content, please Sign In or Sign Up [/HIDE-THANKS] Link to comment Share on other sites More sharing options...
Recommended Posts