Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem pulling company address...

Status
Not open for further replies.

syscrash

MIS
Jun 26, 2001
28
US
Hello, everyone. I have a problem with one of my crystal reports (version 7). I have a formula object that shows the company name and it looks like it pulls that from a different database because I don’t have a field by this name at all in the current database. That is working fine but on my report I want to be able to pull the address of the company as well and it is stored in the same database as the name. I have created a formula just like the other one but the address is not showing when I print, the company name shows fine but not the address. I have the formula setup in my new object just like the other one, which is just 2 double quotes “”.

I would appreciate any input that I can get on this.
 
Posting your formula would help a lot.

Not knowing what is contained in the formula but I encounter the same problem if any field in your formula contains a null value.

Here a sample code I use for address. Just tailor it to fit your needs

Code:
StringVar addr := "";

If IsNull({ADDRESSES.STREET_NUMBER}) Then
    addr := addr
Else
    addr := addr + ToText({ADDRESSES.STREET_NUMBER});

If IsNull({ADDRESSES.DIRCT_CD_DIRECTION_CODE}) Then
    addr := addr
Else
    addr := TrimLeft(addr +" "+{ADDRESSES.DIRCT_CD_DIRECTION_CODE});

If IsNull({ADDRESSES.STREET_NAME}) Then
    addr := addr
Else
    addr := TrimLeft(addr + " " + {ADDRESSES.STREET_NAME});

If IsNull({ADDRESSES.DIRECT_SUFFIX}) Then
    addr := addr 
Else
    addr := TrimLeft(addr +" "+{ADDRESSES.DIRECT_SUFFIX});

if isnull({ADDRESSES.SUB_NUMBER}) then
    addr := addr
else addr := addr + " #" + {ADDRESSES.SUB_NUMBER};

If trim(addr) = "" Then
    "No address listed..."
Else
    trim(ADDR)

-lw
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top