mailing labels - square box at end of first line in report

  • Thread starter Scott_Brasted via AccessMonster.com
  • Start date
S

Scott_Brasted via AccessMonster.com

Greetings,

I use the following expression to print mailing labels. When there is a
company name in the record, everything is fine. When there is not a company
name, I get a small square box at the end of the name on the first line. Any
thoughts on what I am missing?

This expression is in the query. "SendTo" is in the report detail section
SendTo: ([CustomerName] & Chr(13) & Chr(10) + [CompanyName] & Chr(13) & Chr
(10) & [Address] & Chr(13) & Chr(10) & [CSZ])

fields involved are all from the same table, record source is a query:
CustomerName: ([ContactFirstName] & " " & [ContactLastName]) - expresiion
form 2 text fields
CompanyName - table text field
Address - table text field
CSZ: ([City] & ", " & UCase([StateOrProvince]) & " " & [PostalCode]) -
expression from 3 text fields

Here is SQL for query:
SELECT Clients.ClientID, Clients.CompanyName, Clients.Address, Clients.City,
Clients.StateOrProvince, Clients.PostalCode, Clients.Country, Clients.
ContactLastName, Clients.ContactFirstName, Clients.ContactTitle, Clients.
PhoneNumber, Clients.FaxNumber, Clients.ReferredBy, Clients.Notes, Clients.
email, Clients.cellnumber, ([ContactFirstName] & " " & [ContactLastName]) AS
CustomerName, ([City] & ", " & UCase([StateOrProvince]) & " " & [PostalCode])
AS CSZ, ([CustomerName] & Chr(13) & Chr(10)+[CompanyName] & Chr(13) & Chr(10)
& [Address] & Chr(13) & Chr(10) & [CSZ]) AS SendTo
FROM Clients
ORDER BY Clients.ContactLastName, Clients.ContactFirstName;

Thanks,
Scott
 
D

Duane Hookom

Try:
SendTo: ([CustomerName] & Chr(13) + Chr(10) + [CompanyName] & Chr(13) &
Chr(10) & [Address] & Chr(13) & Chr(10) & [CSZ])
 
S

Scott_Brasted via AccessMonster.com

Duane,

Zippity do dah! Thank you. I thought it woudl be simple fiix. What does
adding a plus instead of an ampersand in this case do? Does the Chr(10) go
the CmompanyName?

Thanks,
Scott

Duane said:
Try:
SendTo: ([CustomerName] & Chr(13) + Chr(10) + [CompanyName] & Chr(13) &
Chr(10) & [Address] & Chr(13) & Chr(10) & [CSZ])
Greetings,
[quoted text clipped - 29 lines]
Thanks,
Scott
 
D

Duane Hookom

I thought you would know what the difference is between + and & since your
initial post used them. The + will propogate a null value.

--
Duane Hookom
Microsoft Access MVP


Scott_Brasted via AccessMonster.com said:
Duane,

Zippity do dah! Thank you. I thought it woudl be simple fiix. What does
adding a plus instead of an ampersand in this case do? Does the Chr(10) go
the CmompanyName?

Thanks,
Scott

Duane said:
Try:
SendTo: ([CustomerName] & Chr(13) + Chr(10) + [CompanyName] & Chr(13) &
Chr(10) & [Address] & Chr(13) & Chr(10) & [CSZ])
Greetings,
[quoted text clipped - 29 lines]
Thanks,
Scott

--



.
 
S

Scott_Brasted via AccessMonster.com

Duane,

I'm sorry I must not have phrased my question correctly. I do know the
difference between & and +. However, I do not know much about chr(10) and
chr(13). So I did not know where to put the + in regard to the chr(10) and
chr(13) for the CompanyName field. I really appreciate your help with this.
I guess my question should have been how does the + relate to the chrs and
the field in this case.

Again thanks,
Scott

Duane said:
I thought you would know what the difference is between + and & since your
initial post used them. The + will propogate a null value.
[quoted text clipped - 14 lines]
 
D

Duane Hookom

Chr(13) will display a square box when used without the Chr(10).

If CompanyName is Null then the entire expression below is Null:
Chr(13) + Chr(10) + [CompanyName]

If CompanyName is Null then the expression below returns Chr(10) which is
the square:
Chr(13) & Chr(10) + [CompanyName]

--
Duane Hookom
Microsoft Access MVP


Scott_Brasted via AccessMonster.com said:
Duane,

I'm sorry I must not have phrased my question correctly. I do know the
difference between & and +. However, I do not know much about chr(10) and
chr(13). So I did not know where to put the + in regard to the chr(10) and
chr(13) for the CompanyName field. I really appreciate your help with this.
I guess my question should have been how does the + relate to the chrs and
the field in this case.

Again thanks,
Scott

Duane said:
I thought you would know what the difference is between + and & since your
initial post used them. The + will propogate a null value.
[quoted text clipped - 14 lines]
Thanks,
Scott

--



.
 
J

John Spencer

Actually, I believe it will return Chr(13) not Chr(10). The precedence of the
operators would perform the + concatenate first and then the & concatenate.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
D

Duane Hookom

Of course. Thanks John.

--
Duane Hookom
Microsoft Access MVP


John Spencer said:
Actually, I believe it will return Chr(13) not Chr(10). The precedence of the
operators would perform the + concatenate first and then the & concatenate.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Duane said:
Chr(13) will display a square box when used without the Chr(10).

If CompanyName is Null then the entire expression below is Null:
Chr(13) + Chr(10) + [CompanyName]

If CompanyName is Null then the expression below returns Chr(10) which is
the square:
Chr(13) & Chr(10) + [CompanyName]
.
 
S

Scott_Brasted via AccessMonster.com

Thank you both. I appreciate the info. Learn every day.

Best,
Scott

Duane said:
Of course. Thanks John.
Actually, I believe it will return Chr(13) not Chr(10). The precedence of the
operators would perform the + concatenate first and then the & concatenate.
[quoted text clipped - 14 lines]
 
Top