Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to count at character number?

Status
Not open for further replies.

paispatin

Technical User
Oct 21, 2003
62
A1
Dear all,

I have this one :

A1="A9906001"
It mean : (A9906=front code) (001= count number)

How to make count number is counting 1 by 1?
What I need is :
A2="A9906002"
A3="A9906003"

I already make this program:

a="A9906001"
b=RIGHT(a,3)
c=LEFT(a,5)

so I got b="001", now how do I count b so it become something like this :
b=b+1 ==> 001+1=002 ==> b="002"
or
b=b+2 ==> 001+1=003 ==> b="003"
and than join with this program :

newnumber=c+b && for "A9906002"


I think VFP 8 have functions to solve my problem but I still don't know yet.

Thank you in advance
 
paispatin,

you can use this code:

Code:
b = padl( transform( val(b)+1 ), 3, '0' )


hth,

Stefan
 
Yes Stefan, that's what I need.
Thank you very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top