jrollins138
asked on
Suppressing blank lines in an address block
Okay, I've been fooling around with this about an hour. It's time to bring in the experts!
I'm using CR 2008.
I'm trying to suppress blank lines in an address block on a form I'm creating (customer statements). I'm a professional programmer just starting to fool around with CR.
Bad:
========================== =====
Acme Hardware
123 Easy Lane
(blank)
New York, NY 12345
========================== =====
Good:
========================== =====
Acme Hardware
123 Easy Lane
New York, NY 12345
========================== =====
I've tried to solve this using a formula. I've set it to "Basic Syntax". (See attached)
The formula is returning blanks.
What am I doing wrong?
Thanks for your help.
Jim
I'm using CR 2008.
I'm trying to suppress blank lines in an address block on a form I'm creating (customer statements). I'm a professional programmer just starting to fool around with CR.
Bad:
==========================
Acme Hardware
123 Easy Lane
(blank)
New York, NY 12345
==========================
Good:
==========================
Acme Hardware
123 Easy Lane
New York, NY 12345
==========================
I've tried to solve this using a formula. I've set it to "Basic Syntax". (See attached)
The formula is returning blanks.
What am I doing wrong?
Thanks for your help.
Jim
dim buf as String
buf = {COMPANIES.COMPANY_NAME}
if Length({COMPANIES.ADDRESS1}) > 0 then
buf = buf & Chr(13) & {COMPANIES.ADDRESS1}
end if
if Length({COMPANIES.ADDRESS2}) > 0 then
buf = buf & Chr(13) & {COMPANIES.ADDRESS2}
end if
if Length({COMPANIES.ADDRESS3}) > 0 then
buf = buf & Chr(13) & {COMPANIES.ADDRESS3}
end if
if Length({COMPANIES.CITY}) > 0 then
buf = buf & Chr(13) & {COMPANIES.CITY} & ", " & {COMPANIES.CITY} & " " & {COMPANIES.ZIP_CODE}
end if
if (Length({COMPANIES.COUNTRY}) > 0) and ({COMPANIES.COUNTRY} <> "US") then
buf = buf & Chr(13) & {COMPANIES.COUNTRY}
end if
formula = buf
I don't see anything wrong with the formula so long as the fields are empty or NULL if they don't have a value.
Since that isn't the formula you are using since it has CITY in twice and missing State.
Can you copy and paste the actual formula?
mlmcc
Since that isn't the formula you are using since it has CITY in twice and missing State.
Can you copy and paste the actual formula?
mlmcc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
Perhaps you need Length(Trim({COMPANIES.ADD