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

  • Thread starter Thread starter amy2876
  • Start date Start date
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.
 
Use this --
[Address1] & IIF([Address2] Is Null, Chr(13) & Chr(10) & [Address2], Null)

and set Can Grow & Can Shrink to Yes.
 
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.
 
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.
 
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/
 
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.
 
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.
 
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.
 
Back
Top