ACC2000: How to Increment the Numeric Portion of a String (209830)
The information in this article applies to:
This article was previously published under Q209830 Moderate: Requires basic macro, coding, and interoperability skills.
This article applies only to a Microsoft Access database (.mdb).
SUMMARY
This article provides sample code that you can use to set the default value of a bound Text field in a form to the next higher numeric value (default value = highest numeric value + 1).
The sample code does the following:
- It strips any leading text characters and finds the highest numeric value used in a table.
- It adds 1 to the highest numeric value.
- It reconnects the leading text characters.
NOTE: This example assumes that the number of leading text characters is known at the time that the form is designed and that there is at least one record already in the table.
Modification Type: | Major | Last Reviewed: | 6/23/2005 |
---|
Keywords: | kbhowto kbusage KB209830 |
---|
|