Solved

Auto Size font in fixed text box

Posted on 2012-03-29
7
1,600 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

706 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

13 Experts available now in Live!

Get 1:1 Help Now