Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / December 2006

Tip: Looking for answers? Try searching our database.

Address Label Problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DSmith - 14 Dec 2006 21:02 GMT
Using this formula in a report:
=([FirstName] & " " & [LastName]) & Chr(13) & Chr(10) & [Address] & Chr(13)
& Chr(10) & [Address2] & Chr(13) & Chr(10)  & [City] & "," & [State] & " " &
[zipcode]

If there is no address2 I get a blank line. Anyone know how I can get rid of
the blank line? Already have it marked yes to expand and shrink. Thanks
John Spencer - 14 Dec 2006 21:47 GMT
Try the following

=([FirstName] & " " & [LastName]) & Chr(13) & Chr(10) &
[Address] & Chr(13) &
Chr(10) & ([Address2] + Chr(13) + Chr(10))  &
[City] & "," & [State] & " " &  [zipcode]

This uses the fact that when you concatenate strings using the + sign you
get null if one of the strings is null

Null + "This"  is Null
Null & "This" is "This"

If the above doesn't work then Address2 is not null, but probably contains
spaces or a zero-length string.  If that is the case, you will need to use
an IIF statement.

... & Address2 & IIF(Len(Trim(Address2 & "")) = 0, "", Chr(13) & Chr(10)) &
City & ...

> Using this formula in a report:
> =([FirstName] & " " & [LastName]) & Chr(13) & Chr(10) & [Address] &
[quoted text clipped - 3 lines]
> If there is no address2 I get a blank line. Anyone know how I can get rid
> of the blank line? Already have it marked yes to expand and shrink. Thanks
DSmith - 18 Dec 2006 15:19 GMT
Thanks, guys! Using the IIF statement made it work.

> Try the following
>
[quoted text clipped - 24 lines]
>> of the blank line? Already have it marked yes to expand and shrink.
>> Thanks
fredg - 14 Dec 2006 22:03 GMT
> Using this formula in a report:
> =([FirstName] & " " & [LastName]) & Chr(13) & Chr(10) & [Address] & Chr(13)
[quoted text clipped - 3 lines]
> If there is no address2 I get a blank line. Anyone know how I can get rid of
> the blank line? Already have it marked yes to expand and shrink. Thanks

Try it this way:

= [First Name] & " " & [LastName] & Chr(13) & Chr(10) & [Address] &
Chr(13) & Chr(10) & ([Address2] + (Chr(13) & Chr(10))) & [City] & ","
& [State] & " " &  [zipcode]

Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.