One seemingly obscure requirement that comes up more often than one would think is the ability to increment a number at the end of a text string. For instance, passing a text string of "Apple1" would return "Apple2". In addition, there are a multitude of padding options ("Apple002"), decrementing number suffixes (Passing "Apple4" and decrementing by 1 returns "Apple3"), and even removing the number suffix altogether (Passing "Apple02" returns "Apple"). Finally, one can increment (or decrement) numbers by more than 1, or even pass the same number with different padding.

The function is named fncIncrementItem

The versatility of this function makes it a handy drop-in function to have on hand. It is heavily commented throughout, and one can optimize it for client solutions or process-heavy looping operations. The attachment includes a highly-detailed word document explaining the process, an identical document in single web page format, and a database that contains the function along with a form that demonstrates the function protocols using your inputs.

This function was developed on Access 2016, but saved in Access 2003 format (MDB), and should work for all versions from 2003.