How to add a return in a text box if second field has data

A

amy2876

I have Address and Address2 in one text box on a report that is an invoice.
How do I get "Address2" to go on the next line down from "Address" without
creating a separate text box for "Address2".

If I create two text boxes, but a customer has no info in "Address2" I am
left with a blank line between the address and the City, State and Zip.

EXAMPLE:

Customer with no Address2, but two text boxes:
Mr. Joe Blow
1234 Blah St.

Someplace, KS 12345

Customer with Address2, but one text box:
Ms. Jane Doe
c/o Spot Corp. 567 Yuck St.
Anywhere, AK 67890

I hope that makes sense and someone can help me.

Thanks in advance for your help.
 
K

KARL DEWEY

Use this --
[Address1] & IIF([Address2] Is Null, Chr(13) & Chr(10) & [Address2], Null)

and set Can Grow & Can Shrink to Yes.
 
A

amy2876

That did not work.

KARL DEWEY said:
Use this --
[Address1] & IIF([Address2] Is Null, Chr(13) & Chr(10) & [Address2], Null)

and set Can Grow & Can Shrink to Yes.

amy2876 said:
I have Address and Address2 in one text box on a report that is an invoice.
How do I get "Address2" to go on the next line down from "Address" without
creating a separate text box for "Address2".

If I create two text boxes, but a customer has no info in "Address2" I am
left with a blank line between the address and the City, State and Zip.

EXAMPLE:

Customer with no Address2, but two text boxes:
Mr. Joe Blow
1234 Blah St.

Someplace, KS 12345

Customer with Address2, but one text box:
Ms. Jane Doe
c/o Spot Corp. 567 Yuck St.
Anywhere, AK 67890

I hope that makes sense and someone can help me.

Thanks in advance for your help.
 
A

amy2876

Sorry, I should specify.... "Address2" did not show up, but "Address" did.

amy2876 said:
That did not work.

KARL DEWEY said:
Use this --
[Address1] & IIF([Address2] Is Null, Chr(13) & Chr(10) & [Address2], Null)

and set Can Grow & Can Shrink to Yes.

amy2876 said:
I have Address and Address2 in one text box on a report that is an invoice.
How do I get "Address2" to go on the next line down from "Address" without
creating a separate text box for "Address2".

If I create two text boxes, but a customer has no info in "Address2" I am
left with a blank line between the address and the City, State and Zip.

EXAMPLE:

Customer with no Address2, but two text boxes:
Mr. Joe Blow
1234 Blah St.

Someplace, KS 12345

Customer with Address2, but one text box:
Ms. Jane Doe
c/o Spot Corp. 567 Yuck St.
Anywhere, AK 67890

I hope that makes sense and someone can help me.

Thanks in advance for your help.
 
M

Marshall Barton

amy2876 said:
I have Address and Address2 in one text box on a report that is an invoice.
How do I get "Address2" to go on the next line down from "Address" without
creating a separate text box for "Address2".

If I create two text boxes, but a customer has no info in "Address2" I am
left with a blank line between the address and the City, State and Zip.

EXAMPLE:

Customer with no Address2, but two text boxes:
Mr. Joe Blow
1234 Blah St.

Someplace, KS 12345

Customer with Address2, but one text box:
Ms. Jane Doe
c/o Spot Corp. 567 Yuck St.
Anywhere, AK 67890


Use an expression like:
=Address1 & (Chr(13) + Chr(10) + Address2)

Set the text box and its section's CanGrow property to Yes/
 
K

KARL DEWEY

Try it this way --
[Address1] & Chr(13) & Chr(10) & [Address2]


amy2876 said:
Sorry, I should specify.... "Address2" did not show up, but "Address" did.

amy2876 said:
That did not work.

KARL DEWEY said:
Use this --
[Address1] & IIF([Address2] Is Null, Chr(13) & Chr(10) & [Address2], Null)

and set Can Grow & Can Shrink to Yes.

:

I have Address and Address2 in one text box on a report that is an invoice.
How do I get "Address2" to go on the next line down from "Address" without
creating a separate text box for "Address2".

If I create two text boxes, but a customer has no info in "Address2" I am
left with a blank line between the address and the City, State and Zip.

EXAMPLE:

Customer with no Address2, but two text boxes:
Mr. Joe Blow
1234 Blah St.

Someplace, KS 12345

Customer with Address2, but one text box:
Ms. Jane Doe
c/o Spot Corp. 567 Yuck St.
Anywhere, AK 67890

I hope that makes sense and someone can help me.

Thanks in advance for your help.
 
A

amy2876

That did it!! Thank you!! :)

KARL DEWEY said:
Try it this way --
[Address1] & Chr(13) & Chr(10) & [Address2]


amy2876 said:
Sorry, I should specify.... "Address2" did not show up, but "Address" did.

amy2876 said:
That did not work.

:

Use this --
[Address1] & IIF([Address2] Is Null, Chr(13) & Chr(10) & [Address2], Null)

and set Can Grow & Can Shrink to Yes.

:

I have Address and Address2 in one text box on a report that is an invoice.
How do I get "Address2" to go on the next line down from "Address" without
creating a separate text box for "Address2".

If I create two text boxes, but a customer has no info in "Address2" I am
left with a blank line between the address and the City, State and Zip.

EXAMPLE:

Customer with no Address2, but two text boxes:
Mr. Joe Blow
1234 Blah St.

Someplace, KS 12345

Customer with Address2, but one text box:
Ms. Jane Doe
c/o Spot Corp. 567 Yuck St.
Anywhere, AK 67890

I hope that makes sense and someone can help me.

Thanks in advance for your help.
 
J

John Spencer MVP

Small error in the code

[Address1] & IIF([Address2] Is NOT Null, Chr(13) & Chr(10) & [Address2], Null)

Or another way
[Address1] & IIF([Address2] Is Null, Null, Chr(13) & Chr(10) & [Address2])

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
Sorry, I should specify.... "Address2" did not show up, but "Address" did.

amy2876 said:
That did not work.

KARL DEWEY said:
Use this --
[Address1] & IIF([Address2] Is Null, Chr(13) & Chr(10) & [Address2], Null)

and set Can Grow & Can Shrink to Yes.

:

I have Address and Address2 in one text box on a report that is an invoice.
How do I get "Address2" to go on the next line down from "Address" without
creating a separate text box for "Address2".

If I create two text boxes, but a customer has no info in "Address2" I am
left with a blank line between the address and the City, State and Zip.

EXAMPLE:

Customer with no Address2, but two text boxes:
Mr. Joe Blow
1234 Blah St.

Someplace, KS 12345

Customer with Address2, but one text box:
Ms. Jane Doe
c/o Spot Corp. 567 Yuck St.
Anywhere, AK 67890

I hope that makes sense and someone can help me.

Thanks in advance for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top