Crystal Reports (4.6.1): String Concatenation in a formula

I have a Crystal Report where I have a Formula field.  The formula field simply concatenates two text fields from the database. My function bombs when the total length of the concatenated string goes beyond 254.  I get an error saying that string cannot be more than 254 characters.  How can I solve this problem?

An early response would be greatly appreciated.

Thanks
jychAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jfleminCommented:
Left ({Field1}+{Field2},254 )
0
vbkecoCommented:
You need to first check the length of each field in your Crystal Report.  In jflemin's example, if their combined length is greater than  254 characters you'll lose some data from Field2.  If that happens, try trimming the blanks off the end of each field first, check the new field lengths, then combine them.
0
jychAuthor Commented:
What if the total VALID length is more than 254?  What should I do then?
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

vbkecoCommented:
You still need to know the TOTAL length of the fields.  Lets say, for example, that the total length of each field is as follows:

Field1 = 175 characters long, and
Field2 = 200 characters long.  

Their combined total is 375 characters.

Use the following statements in your subroutine:

Dim Field1 as String * 175
Dim Field2 as String * 200
Dim NewField as String * 375

NewField = Field1 + Field2

Hope it works!
vbkeco
0
jychAuthor Commented:
I like vbkeco's answer better.  How would you get the points?
0
vbkecoCommented:
Thanks jych, I assume it fixed your problem?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.