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!

The function below currently works

Status
Not open for further replies.

Corinne

Programmer
May 15, 2001
146
US
The function below currently works just fine. The "*" on either end are there as the data in the string is a barcode.

"*" + Trim({CusCushionInv.BaseModel} + "*")

I now need to program for the possibility of a space in that string as it can not be output to a barcode with the space. What I want to do is have a replace function that looks for a space and replaces it with an underscore _ character. This is what I've come up with but I have something wrong as I'm getting an error: "Too many arguments have been given to this function."

Replace ("*" + Trim(({CusCushionInv.BaseModel} + "*"), " ", "_"))

Can anyone see what my problem might be? I'm thinking that it's a syntax problem but I'm not sure.

Thanks
 
As you thought, the syntax was off.

Try this:

Replace(("*" + trim({CusCushionInv.BaseModel} + "*")), " ", "_")


-dave
 
Or

"*" + Replace(trim({CusCushionInv.BaseModel})," ","_") + "*"

-LB

 
I would bracket this string a little different

"*" + Trim({CusCushionInv.BaseModel} + "*")

as this formula stands the "Trim is not effective at removing the space to the right in {CusCushionInv.BaseModel} ....this is because Trim only removes spaces at each end....but you add a "*" before you preform the trim so it would not be removed.

A better way to do it is

"*" + Trim({CusCushionInv.BaseModel}) + "*"

now that should work better for you
now if there are further spaces to get rid of you can use Replace like this

Replace("*" + trim({CusCushionInv.BaseModel}) + "*", " ", "_")





Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top