Removing Extra Spaces on a Label

The following is an Extract from a Question I received from All Experts. (www.allesperts.com – a great place to visit if you have a question on anything, not just IT).

Question:

I am doing mailing labels. My table has the following fields: Husband name; spouse name; lastname; address; city; state and zip. It works fine, but if there is no spouse name or it is a single woman with no husband, it leaves an ugly gap on the label . Can I get rid of this problem?

Thanks for the help

Answer:

Many thanks for your question - try the following:

Apply the Can Shrink property to husband and spouse controls. That way, Access omits the blank line when there's no value. Unfortunately, this technique won't work if your control has an attached label as Access still prints the label text.

If you are not sure how to do this, right click on one of the above fields and choose properties from the drop down list.

Then, with the properties window open, click on the 'Format' tab and change the 'Can Shrink' property from No to Yes.

By the way, the Trim function removes blank spaces from the beginning and end of strings (text) so that things line up nicely.

 

Do you like this tip? Subscribe to my weekly Newsletter to receive tips weekly via email. Click Here to subscribe.