X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Increment A Number Suffix On A Text Item (and More), Access 2016    
post Dec 3 2018, 08:01 PM

Posts: 296
Joined: 27-February 06
From: Long Beach CA

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.
Attached File(s)
Attached File  fncIncrementItem.zip ( 101.19K )Number of downloads: 30
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    23rd August 2019 - 06:50 AM