Link to home
Create AccountLog in
Avatar of smpross
smpross

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of newood
newood

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of smpross
smpross

ASKER

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