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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to capture an interger as a chater. 2

Status
Not open for further replies.

Proteus7

IS-IT--Management
Feb 26, 2002
75
US
Hi,

I am using VFP 6.0. On a certian form I need to give incremental name numbers to a field and I can't seem to figuer it out.

Here is the situation. The page is for the use of putting in new stock into the inventory. But once in a great while on a job some new stock is used but its not perminet stock. Sort of a non-stock item that is being used for that one job and my never be used again. But the item must have an id or it will not produce the paperwork corectly. I thought about just giving it its own stock number but it needs to be unique. All other stock numbers consists of chacter and numeric numbers.

What I want to do is to set up a check box that when click it it would gent the next Ids number which is an interger (auto incrementing record id number) and put it with the word NON-STOCK32 or something along that line.

Does anyone know the code for changing numeric chacters into alpha numeric chacters. I guess that is the right way to say it.


Thanks,

Larry
 

I would recommend usign STR() rather than TRANSFORM(), as transform is known to be slower.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I tried those they did not work. Unless I am putting it in wrong.
Select * from ids;
where Table = "INVENTORY";
into cursor Stockid

THISFORM.Main.NewStock.Text8.value = transform("Non-Stock" + Nextid)


I also have tried the str("Non-Stock" + Nextid)

I have also tired it with a coma in between them and also with nothing in between them. I keep getting errors. Either it wont except the line because of a missing command phrase or when it runs it says miss matched operator.

I am sure that its how I am phrasing it.

Larry
 

STR() will change a numeric value into a character string, so since the first part is already character, try:
Code:
"Non-Stock" + alltrim(str(Nextid))

or

Code:
"Non-Stock" + transform(Nextid)

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 

But you don't have to put "Non-Stock" inside the function, it's already character string. Try

THISFORM.Main.NewStock.Text8.value="Non-Stock"+STR(NextID)

 
Oh yes, I forgot, Alltrime() as Mike Gagnon have shown would be useful.
 
Thanks guys,

You both were a lot of help. I knew it was something stupid that I was forgetting. I had all the code but just in the wrong order.

I was going insane over it.


Thanks again,

Larry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top