Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Label Question?

Status
Not open for further replies.

BennyWong

Technical User
May 19, 2002
86
0
0
US
Hello All,
I am currently working with Access 2000. I am trying to create a mailing label. The label is setup as:

FirstName LastName, Title
Organization
Address
City, State Zip

The problem that I am having is the Organization character
wraps down to the next line on the Address line. I would
like to limit the Organization line to only 30 characters.
How can I do this? This is currently what I have:

Public Function Avery_Organization(Organization)
' Trim to 30 characters only starting at 1 to 30
If Len(Avery_Organization) > 30 Then
Avery_Organization = Mid(Avery_Organization, 1, 30)
End If
End Function

Thanks for any help or suggestion in advance.

 
Benny,

So near yet so far ... what you have is almost right:

Change it to read as follows:

Public Function Avery_Organization(Organization)
' Trim to 30 characters only starting at 1 to 30
If Len(Organization) > 30 Then
Avery_Organization = Mid(Organization, 1, 30)
else
Avery_Organization = Organization
End If
End Function

You were confusing the function name with the function argument (or parameter).

Actually you really dont need to go to all that trouble. Simply use the "left" function; it will do the same trick, and work even if the Organisation is less than 30 characters (as long as its not NULL).

eg. Left(Organisation, 30)

Hope this helps,

Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)
 
HELP!
I have a report with a table as its recordsource. In the report I have $0.00 values. I would like to hide all the zero values. IS THIS POSSIBLE...
 
Hello Steve,
Thanks for your responding to my question. If I understand your answer I could use either solution to solve my problem. If I use your solution what should I do if there is a null for the field Organization? Thanks for your response in advance.

Benny Wong
 
Try replacing:

Left(Organisation, 30)

with Left(nz(Organisation, ""), 30)

This would replace a null string with an empty string prior to finding the leftmost 30 characters.

You could do a similar nz application on the Organisation field with the other code.

Rgds,
Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top