Link to home
Start Free TrialLog in
Avatar of chestera
chestera

asked on

Update a number

Hi EE

I have a problem updating a number. Problem the number starts with a character. Here is an example
C000001
D000001
R000001
They are project numbers once used they are updated by one. I tried separating the Character from the number then appending on the form but the user wants the leading zero's shown. Any help appreciated

chestera
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Assuming it is ALWAYS a single letter followed by digits...


UPDATE SomeTable
SET MyColumn = Left(MyColumn, 1) & Format(Val(Right(MyColumn, 6)) + 1, "000000")

Open in new window

Avatar of chestera
chestera

ASKER

matthewspatrick

Thank you for you reply. At the moment there is only one character but might change latter. I thought about using the Left() function

Alan
matthewspatrick

Is there away to detect how many characters if so problem solved

Alan
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
matthewspatrick

Many thanks Patrick

Alan
matthewspatrick
 Hi Patrick sorry to trouble you
Getting error missing end bracket. I copied and pasted

SET SomeColumn = RegExpFind([SomeColumn], "\D+", 1) & Format(Val(RegExpFind([SomeColumn, "\d+", 1)) + 1, "000000")

Alan
matthewspatrick

Found it missing ] SomeColumn

Alan