Report Design

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can I insert a manual line break in a conditional expression? For example:
If Address2 is null, print Address; otherwise, print Address, go to the next
line and print Address2.
 
Use the IIF statement in your query or in the text box you now use for
Address. Remove the text box that has Address2 as source - it is not needed.

Brueez said:
I pasted your suggestion directly into my report design and what I got was a
"box" between Address & Address2; still on the same line. What do you think
went wrong?

KARL DEWEY said:
IIF([Address2] Is Null, [Address],[Address]&Chr(13)&[Address2])

Brueez said:
Can I insert a manual line break in a conditional expression? For example:
If Address2 is null, print Address; otherwise, print Address, go to the next
line and print Address2.
 
Actually, it must be Chr(13) & Chr(10), in that order.

An alternative to using the IIf statement would be:

[Address] & (Chr$(13) & Chr$(10) + [Address2])

This takes advantage of the fact that + propagates Nulls, while & doesn't.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


KARL DEWEY said:
Use the IIF statement in your query or in the text box you now use for
Address. Remove the text box that has Address2 as source - it is not
needed.

Brueez said:
I pasted your suggestion directly into my report design and what I got
was a
"box" between Address & Address2; still on the same line. What do you
think
went wrong?

KARL DEWEY said:
IIF([Address2] Is Null, [Address],[Address]&Chr(13)&[Address2])

:

Can I insert a manual line break in a conditional expression? For
example:
If Address2 is null, print Address; otherwise, print Address, go to
the next
line and print Address2.
 
I tried using this IIF statement in my query and got the same result as before.
Also, I don't have a text box for Address and another for Address2. Instead
I have an unnamed text box whose source is:
=IIf(IsNull([ADDRESS2]),[ADDRESS],[ADDRESS] & ", " & [ADDRESS2]). If I
substitute Chr(13) for ", " I get that little box symbol between Address and
Address2 when I go to print preview.

KARL DEWEY said:
Use the IIF statement in your query or in the text box you now use for
Address. Remove the text box that has Address2 as source - it is not needed.

Brueez said:
I pasted your suggestion directly into my report design and what I got was a
"box" between Address & Address2; still on the same line. What do you think
went wrong?

KARL DEWEY said:
IIF([Address2] Is Null, [Address],[Address]&Chr(13)&[Address2])

:

Can I insert a manual line break in a conditional expression? For example:
If Address2 is null, print Address; otherwise, print Address, go to the next
line and print Address2.
 
Thanks! That did the trick.

Douglas J. Steele said:
Actually, it must be Chr(13) & Chr(10), in that order.

An alternative to using the IIf statement would be:

[Address] & (Chr$(13) & Chr$(10) + [Address2])

This takes advantage of the fact that + propagates Nulls, while & doesn't.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


KARL DEWEY said:
Use the IIF statement in your query or in the text box you now use for
Address. Remove the text box that has Address2 as source - it is not
needed.

Brueez said:
I pasted your suggestion directly into my report design and what I got
was a
"box" between Address & Address2; still on the same line. What do you
think
went wrong?

:

IIF([Address2] Is Null, [Address],[Address]&Chr(13)&[Address2])

:

Can I insert a manual line break in a conditional expression? For
example:
If Address2 is null, print Address; otherwise, print Address, go to
the next
line and print Address2.
 
Back
Top