Crystal Error in C# application due to crystal Reports formula

Hi All,
I am placing this question in this area because the crystal problem is occuring in our application even though the formula shows "No errors found" in the crystal formula wizard.  We are using Visual Studio 2003 and Crystal Reports 10.0.  We are passing data to Crystal using an XSD.  I should note that without the Formula fields, the report displays properly in the application.  

However, when I create a formula and add it to the report, I get an error message.

The formula:

tringVar BillByName :="";
StringVar BillByAddress1 :="";
StringVar BillByAddress2 :="";
StringVar BillByCity :="";
StringVar BillByRegionCode :="";
StringVar BillByPostalCode :="";
StringVar BillByCountryCode :="";

if {InvoiceHeader.DivisonName} <> "" then BillByName = ({InvoiceHeader.DivisonName} + chr(13) + chr(10));

if {InvoiceHeader.RemitAddress1} <> "" then BillByAddress1 = {InvoiceHeader.RemitAddress1} + chr(13) + chr(10);
if {InvoiceHeader.RemitAddress2} <> "" then BillByAddress2 = {InvoiceHeader.RemitAddress2} + chr(13) + chr(10);
if {InvoiceHeader.RemitCity} <> "" then BillByCity = {InvoiceHeader.RemitCity} + ", ";
if {InvoiceHeader.RemitRegionCode} <> "" then BillByRegionCode = {InvoiceHeader.RemitRegionCode} + "  ";
if {InvoiceHeader.RemitPostalCode} <> "" then BillByPostalCode = {InvoiceHeader.RemitPostalCode};

BillByName + BillByAddress1 + BillByAddress2 + BillByCity + BillByRegionCode + BillByPostalCode;


The Error message that I receive is as follows
The Field name is not known.
Details: errorKind
Error in File c:\Program name\Invoice.rpt
Error in formula <BilledBy>
'StringVar BillByName :="";
'
The field name is not known.
Details: errorKind

Crystal Reports says that the formula is ok inside of the CRW.  Also the Error in formula seems to always be the first line of the formula.

Any help would be greatly appreciated.

Scott
smprossAsked:
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.

newoodCommented:
If it's getting field name not know it's likely erroring on the {InvoiceHeader.RemitAddress1} portion of the formula.  Make sure that you can find the right data source in your program or that it is defined properly.  When you open it up in crystal that ODBC connection is embedded within the report so it may work just fine.  Make sure your program is looking at the same source.
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
smprossAuthor Commented:
Newood,
When I put those fields into the report individually, they appear without any problem even when I run the application... Any other idesas?

Thanks for the suggestion.

Scott
0
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
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.