Hi,
I'm using Access 2010 on both a Win 7 Pro box and a Win 11 Pro box.
My database prints address labels on Avery type 5167/8167 (1/2" x 1&3/4").
There are 3 lines for the address and all 3 lines can grow or shrink.
The first line prints the name; the second line prints the street address, and the third line prints the city, state & zip code.
When I have two lines for the street address, for instance an apartment number or other required information for delivery, I want the second address line to print as 2 lines.
The code for the second address line is as follows:
This works as intended, for example:
However, when I first started coding this, I coded as follows:
This did not work as intended and gave me the following:
After reading some posts containing the Chr(13) and Chr(10) codes, I also tried the following:
But after entering it as above, when looking at it again it showed as follows:
Which when executed, popped a window asking for vbCrLf.
I find it curious that the order of the Chr codes matters.
Does anyone have an explanation?
Thanks,
Vic
I'm using Access 2010 on both a Win 7 Pro box and a Win 11 Pro box.
My database prints address labels on Avery type 5167/8167 (1/2" x 1&3/4").
There are 3 lines for the address and all 3 lines can grow or shrink.
The first line prints the name; the second line prints the street address, and the third line prints the city, state & zip code.
When I have two lines for the street address, for instance an apartment number or other required information for delivery, I want the second address line to print as 2 lines.
The code for the second address line is as follows:
Code:
=Trim([Address Line 1]) & Chr(13) & Chr(10) & Trim([Address Line 2])
This works as intended, for example:
255 Main St.
Apt 7B
However, when I first started coding this, I coded as follows:
Code:
=Trim([Address Line 1]) & Chr(10) & Chr(13) & Trim([Address Line 2])
This did not work as intended and gave me the following:
255 Main St.Apt7B
After reading some posts containing the Chr(13) and Chr(10) codes, I also tried the following:
Code:
=Trim([Address Line 1]) & vbCrLf & Trim([Address Line 2])
But after entering it as above, when looking at it again it showed as follows:
Code:
=Trim([Address Line 1]) & [vbCrLf] & Trim([Address Line 2])
Which when executed, popped a window asking for vbCrLf.
I find it curious that the order of the Chr codes matters.
Does anyone have an explanation?
Thanks,
Vic