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

Character test 1

Status
Not open for further replies.

lashwarj

IS-IT--Management
Nov 1, 2000
1,067
US
How would I go about running a character test.

Ex. The user enters in a number in an item field, all items have a code and the code is associated by the item number (ex. sport items have a 5 digit number, clothing has a 6)

How can I run a character test that will do something like below.

IF This.value = ****
Thisform.Department = "Sport"
ENDIF

The code I can do I just dont know how to run the character test in foxpro. Thank you guys
 
afternoon

not sure if i get you correctly but ..

nMylength=len(alltrim(thisform.textbox1.value))

will give you the number of characters in a string.

monkey
 
sorry forgot to add the bit about after that.

do case

case nMylength=5
Thisform.Department = "Sport"

case nMylength=8
Thisform.Department = "haberdashery"

endcase

etc

monkey
 
I tried the LENC since the item number sometimes has alpha numeric contents, it returns the same number no matter what.
 
Ahhhhhhhhhhh the alltrim was what I didnt have. It works perfectly, thank you.
 
wow a star

thanks a lot

but i'm not sure alltrim() deserves a star

thanks though

monkey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top