converting problem

ramitaherwahdan

New member
Local time
Today, 11:02
Joined
Feb 21, 2011
Messages
9
I am having an access database with field "examnumber", this is a text field. programatically I am trying to get the string and then add 1 to it then save a new one.

example: the old exam number is GRT228, I want to get the last 3 digits from that string then covert it to number so it is read as 228 then add 1 so becomes 229 then make a new entry with new exam number which will be GRT229.

is that possible :rolleyes:

Thanks all,
Rami.
 
Left(examnumber,3) & (Right(examnumber,3) + 1)
 
Thanks alot for the fast and accurate reply :D

it worked
 
a note: it won't work for GRT13
 
Normally I would have asked about whether the GRT even needed to be stored but elected not to last night. If it never changes, only store the number and include the GRT for display only using the Format property.

To work around smig's case:

Left(examnumber,3) & (Mid(examnumber,4) + 1)

You might also be interested in the Format function which will pad leading zeros with shorter numbers to three digits:

Format(whatever,"000")
 
Normally I would have asked about whether the GRT even needed to be stored but elected not to last night. If it never changes, only store the number and include the GRT for display only using the Format property.
I totaly agree

To work around smig's case:

Left(examnumber,3) & (Mid(examnumber,4) + 1)
sorry, I had to give it myself
 

Users who are viewing this thread

Back
Top Bottom