Solved

Auto Size font in fixed text box

Posted on 2012-03-29
7
1,654 Views
Last Modified: 2012-03-30
I am working in Access on a report which will create employee badges.  All the text boxes and labels are a fixed size.

When selecting a font for the employee name, I want to select the largest font available for the text box, however I have no way of knowing how long or short the length of any given name will be.

Does access have a format to resize text in a text box so that no matter how long the string of text is, the font will resize to fit the name in current text box?
0
Comment
Question by:MCaliebe
7 Comments
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 75 total points
ID: 37784692
No.
You would have to develop your own rules for the font size based on trial and error.
0
 
LVL 29

Assisted Solution

by:IrogSinta
IrogSinta earned 75 total points
ID: 37785602
I had the same dilemma before when I made a report for creating sale tags.  I originally developed my own rules as peter57r mentioned.  However when they wanted the tags to look even fancier I discovered a function created by Stephen Lebans called RotateText that made it easy.  In this particular instance I didn't use it to rotate my labels but just to resize them.  It can create a label at runtime that can be a specific size and the text will adjust proportionally.  
     If you want to go this route then here's the link to his site where you could download his function in a sample database:

http://www.lebans.com/rotatetext.htm
0
 

Author Comment

by:MCaliebe
ID: 37786838
I've done general code, tables, query, ect but this seems way over my head. IrogSinta, do you have an example of the rule you used?  I'm not looking for anything fancy...simple font size change is about it.
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 100 total points
ID: 37787007
This is a common question here with no easy answer.

<I want to select the largest font available for the text box,>
Consider this, ...this is 20 characters:
iiiiiiiiiiiiiiiiiiii
...but so is this:
WWWWWWWWWWWWWWWWWWWW
...so how what size font would you use for "20" characters?
What size would a text box be to hold "20" characters?

What about the font "Style" (not just the number of characters...)
20 characters in Times new Roman is not the same size as the same text in Arial.

So, no, there is no "Size Text to Box" feature in Access.

I have seen algorithms that "try" to do this, but they are all approximations and never really work as desired,  and require a lot of tweaking
(Because they all have to use some sort of "Average Font",...some names will be slightly chopped of, other will be a bit to small)
...and generally not worth the trouble IMHO.

If it were me I would simply make the Name textboxes as wide as the paper stock allows, then set the "Can Grow" Property to "Yes" and simply let really long names wrap.

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37787198
<When selecting a font for the employee name, I want to select the largest font available for the text box, >
Let's be clear here...
You want to select a different Font *Style* (Arial, Times New Roman, Comic Sans,...etc)
..or change the font *Size* (10 pt, 12 pt, 20 pt)
Or both...?, ...or neither, more something else entirely...?

Please post a clear graphical example of two extremes and the *EXACT* output you want.
0
 

Author Comment

by:MCaliebe
ID: 37787250
Thanks for everyones input.  I can see the compexity involved here and I will be taking the simple approach ...select a font, size and use it until it doesn't work.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37787636
Yes, also remember that the "Size" of the font effects the Height and Width
so again,  no easy answers here.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now