Line break in Report expression builder

L

LFM

In Access 2000 I was successfully able to do this - but in Access 2003
I am unable to.

I have a report that lists addresses of companies. The query behind
the report has the following example fields

Name
Company Name
Address line 1
Address line 2
City
State
Zip

The report had one unbound field in it with the formula that included
line breaks (enter) in order to have the report display have the
labels print properly and hide the lines for fields that were null, or
expand them if they were not. The expression I had is as follows:

[Name] & "
" & [Company Name] & "
" & [Address Line 1] & "
" & IIf(IsNull([Address Line 2]),[City] & ", " & [State] & " " &
[Zip],[Address Line 2] & "
" & [City] & ", " & [State] & " " & [Zip])

Example displayed:

Jane Doe
MyCompany
123 Nowhere Lane
Suite 123
Nowhere, CA 94563

Example 2

John Doe
MyCompany
123 Nowhere Lane
Nowhere, CA 94536

Now, fast forward to installing Access 2003. When I try to use the
same experssion in a report Access inserts a funny square box where
the manual line break had been. So now my formula looks like

[Name] & "$B""(B " & [Company Name] & "$B""(B" & [Address Line 1] & "$B""(B" &
IIf(IsNull([Address Line 2]),[City] & ", " & [State] & " " & [Zip],
[Address Line 2] & "$B""(B" & [City] & ", " & [State] & " " & [Zip])

And the display looks like

Jane Doe$B""(BMyCompany$B""(B123 Nowhere Lane$B""(BSuite 123$B""(BNowhere, Ca 94563

How do you get the manual line break (paragraph, enter, whatever you
want to call it) to work in the expression builder for reports in
Access 2003?
 
R

Rob Parker

Instead of using a quoted Enter character, use the combination of control
characters for carriage return and line feed (the terminology comes from the
early years of computing, when life consisted of mainframe computers and
line printers). The characters have code numbers 13 and 10, respectivly.
So you would enter an expression such as:

[Name] & Chr(13) & Chr(10) & [Company Name] & ...

in the expression builder.

HTH,

Rob
 
B

Bob Barnes

Try as a linefeed...Chr$(13) = carriage return and Chr$(10) = linefeed

Have....
[Name] & Chr$(13) & Chr$(10)
& [Company Name] & Chr$(13) & Chr$(10)
& [Address Line 1] & Chr$(13) & Chr$(10)
& IIf(IsNull([Address Line 2]),[City] & ", " & [State] & " " &
[Zip],[Address Line 2] & Chr$(13) & Chr$(10)
& [City] & ", " & [State] & " " & [Zip])

HTH - Bob



LFM said:
In Access 2000 I was successfully able to do this - but in Access 2003
I am unable to.

I have a report that lists addresses of companies. The query behind
the report has the following example fields

Name
Company Name
Address line 1
Address line 2
City
State
Zip

The report had one unbound field in it with the formula that included
line breaks (enter) in order to have the report display have the
labels print properly and hide the lines for fields that were null, or
expand them if they were not. The expression I had is as follows:

[Name] & "
" & [Company Name] & "
" & [Address Line 1] & "
" & IIf(IsNull([Address Line 2]),[City] & ", " & [State] & " " &
[Zip],[Address Line 2] & "
" & [City] & ", " & [State] & " " & [Zip])

Example displayed:

Jane Doe
MyCompany
123 Nowhere Lane
Suite 123
Nowhere, CA 94563

Example 2

John Doe
MyCompany
123 Nowhere Lane
Nowhere, CA 94536

Now, fast forward to installing Access 2003. When I try to use the
same experssion in a report Access inserts a funny square box where
the manual line break had been. So now my formula looks like

[Name] & "â–¡ " & [Company Name] & "â–¡" & [Address Line 1] & "â–¡" &
IIf(IsNull([Address Line 2]),[City] & ", " & [State] & " " & [Zip],
[Address Line 2] & "â–¡" & [City] & ", " & [State] & " " & [Zip])

And the display looks like

Jane Doeâ–¡MyCompanyâ–¡123 Nowhere Laneâ–¡Suite 123â–¡Nowhere, Ca 94563

How do you get the manual line break (paragraph, enter, whatever you
want to call it) to work in the expression builder for reports in
Access 2003?
 
L

LFM

Instead of using a quoted Enter character, use the combination of control
characters for carriage return and line feed (the terminology comes from the
early years of computing, when life consisted of mainframe computers and
line printers). The characters have code numbers 13 and 10, respectivly.
So you would enter an expression such as:

[Name] & Chr(13) & Chr(10) & [Company Name] & ...

in the expression builder.

HTH,

Rob


In Access 2000 I was successfully able to do this - but in Access 2003
I am unable to.
I have a report that lists addresses of companies. The query behind
the report has the following example fields
Name
Company Name
Address line 1
Address line 2
City
State
Zip
The report had one unbound field in it with the formula that included
line breaks (enter) in order to have the report display have the
labels print properly and hide the lines for fields that were null, or
expand them if they were not. The expression I had is as follows:
[Name] & "
" & [Company Name] & "
" & [Address Line 1] & "
" & IIf(IsNull([Address Line 2]),[City] & ", " & [State] & " " &
[Zip],[Address Line 2] & "
" & [City] & ", " & [State] & " " & [Zip])
Example displayed:
Jane Doe
MyCompany
123 Nowhere Lane
Suite 123
Nowhere, CA 94563
Example 2
John Doe
MyCompany
123 Nowhere Lane
Nowhere, CA 94536
Now, fast forward to installing Access 2003. When I try to use the
same experssion in a report Access inserts a funny square box where
the manual line break had been. So now my formula looks like
[Name] & "$B""(B " & [Company Name] & "$B""(B" & [Address Line 1] & "$B""(B" &
IIf(IsNull([Address Line 2]),[City] & ", " & [State] & " " & [Zip],
[Address Line 2] & "$B""(B" & [City] & ", " & [State] & " " & [Zip])
And the display looks like
Jane Doe$B""(BMyCompany$B""(B123 Nowhere Lane$B""(BSuite 123$B""(BNowhere, Ca 94563
How do you get the manual line break (paragraph, enter, whatever you
want to call it) to work in the expression builder for reports in
Access 2003?- Hide quoted text -

- Show quoted text -

Thank you to both of you! I knew there had to be a Char code of some
sort - just didn't know which one. In Word its ^p for paragraph, ^l
for line break.
 

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