Crystal Error in C# application due to crystal Reports formula

Posted on 2006-03-22
Last Modified: 2011-09-20
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.

Question by:smpross
    LVL 3

    Accepted Solution

    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.

    Author Comment

    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Live - One-on-One C# Help from Top Experts

    Solve your toughest problems, fast.
    C# experts are online now and ready to help you.

    Article by: Najam
    Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now