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 )
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.
jychAuthor Commented:
What if the total VALID length is more than 254?  What should I do then?
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

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
jychAuthor Commented:
I like vbkeco's answer better.  How would you get the points?
vbkecoCommented:
Thanks jych, I assume it fixed your problem?

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.