|
-
Nov 6th, 2003, 01:47 PM
#1
Thread Starter
Lively Member
Replace function question with syntax
The line 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
-
Nov 6th, 2003, 01:57 PM
#2
Frenzied Member
I have no idea what your CusCushionInv.BaseModel item is, but normally if you want to use the replace function, you'd do it like this:
VB Code:
sMySample = sCompanyName.Replace(" ", "_")
or
VB Code:
sSQL = "SELECT * FROM tbl_Company WHERE CompanyName = '" & sCompanyName.Replace(" ", "_") & "';"
~Peter

-
Nov 6th, 2003, 02:06 PM
#3
Thread Starter
Lively Member
Well, CusCushionInv.BaseModel is the string. This is from a function within Crystal Reports & like I said I need to incorporate the "*" part on each end.
-
Nov 6th, 2003, 02:13 PM
#4
Frenzied Member
So just add the star on.
VB Code:
sMySample = "*" & sCompanyName.Replace(" ", "_") & "*"
Is that not what you want to do?
Or maybe you want:
VB Code:
"*" + Replace(Trim({CusCushionInv.BaseModel}), " ", "_") + "*"
(i think you had too many brackets?)
~Peter

-
Nov 6th, 2003, 02:18 PM
#5
Thread Starter
Lively Member
MRGTI,
That was it. I had the first "*" on the wrong side of the Replace. When I checked the syntax in crystal it cam back without any errors. I'll try printing the barcodes to make sure it works correctly.
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|