Solved

Auto Size font in fixed text box

Posted on 2012-03-29
7
1,764 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
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…

828 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