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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shrink text size if 4+ lines (in a label/report) 2

Status
Not open for further replies.

boxboxbox

Technical User
Apr 22, 2003
108
US
I want my address lines to be centered on the label, but since I can't figure out how to do this automatically I placed the text boxes so they are in the middle.

This works perfectly for three lines; a fourth is a bit low (and thus the whole address is a bit offcenter) but still OK.

However, if I have an address with five lines, the fifth line is then positioned too far off the bottom of the label and doesn't show up. (I don't want to re-position all my lines every day, and if I put them higher, then the three-line addresses are way to high.)

Is there a way to reduce/shrink the size of the text on a condition of five lines or more? Best would be if I could shrink only that one label's text, but if it shrinks the text for all labels, that is fine, too.

Thanks.
 
Is each address line in it's own text field? If so, set each fields "Can Shrink" property to Yes.

Right click the text box - choose properties - Format Tab - Can Shrink = Yes.

This will hide the text box if there is no data and will move the below text boxes with data up.

Hope this helps.

 
You could put two sets of fields in your Detail section. One set is sized for up to 4 lines and one set is sized for 5 lines. Both sets could be bound to the same record fields.

In the OnFormat event of the Detail section, if the contents of line 5 are non-blank, turn the Visible property of the up-to-4-lines fields to False and turn the Visible property of the 5-lines fields to True.

Reverse this if the fifth line is blank.

[shadeshappy] Cruising the Information Superhighway
(your mileage may vary)
 
Unfortunately it is not always the same line that is blank (foreign/business orders), but that is by far the best idea I have heard. I shall see if I can make it work.

Thanks much!
 
Here's another way to handle this:

Add an unbound text box to your detail section to hold the formatted address fields(txtCustAddress). Set its Can Grow and Can Shrink properties to Yes.

In the On Format event of your detail section, put code like this to populate that text box you just added, of course changing to your field names:
Code:
Me.txtCustAddress = IIf(IsNull(Me.[Customer add 1]), "", Me.[Customer add 1] & vbCrLf) & IIf(IsNull(Me.[Customer add 2]), "", Me.[Customer add 2] & vbCrLf) & IIf(IsNull(Me.[Customer add 3]), "", Me.[Customer add 3] & vbCrLf) & IIf(IsNull(Me.[Customer add 4]), "", Me.[Customer add 4] & vbCrLf) & IIf(IsNull(Me.[Customer add 5]), "", Me.[Customer add 5])
 
You should play with the CanGrow property, not CanShrink...

Place all boxes that make up the text one below the other.
Make them equal in size
Align them to left (or right)
Select the one at the top
Set its Height property to 0
Select all the boxes.
CanGrow property = Yes
Format-Size - Shortest
Format-Align - Top

If you look at the design, you will only see a thin line.
When you run the report, the text will be formatted nicely, the missing data will be stripped.

HTH



[pipe]
Daniel Vlas
Systems Consultant

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top