[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Automatically reduce font size on a report to fit text box

Posted on 2009-05-09
9
Medium Priority
?
1,435 Views
Last Modified: 2012-05-06
Is there a way to autimatically have the font size reduce on a report to fit the size of the text box.  I do not want the size of the text box to change...  just the font within the box.
0
Comment
Question by:SteveL13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 24344095
try this in the format event of the Detail section of the report


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
me.text0.FontSize = IIf(len(me.text0.value) > 15, 10, 14)

End Sub

just change the values

0
 

Author Comment

by:SteveL13
ID: 24344206
Hmmm, this isn't working quite right.  If I have a data sting with 12 characters it reduces it down to about a 12 point text but if the field only contains 12 characters then I want the text to be a full 16 pt. type as per the design of the report.
Here's my adjusted code...

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

    Me.txtCustomer.FontSize = IIf(Len(Me.txtCustomer.Value) > 16, 14, 12)

End Sub
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 24344240
this doesn't make sense
<If I have a data sting with 12 characters it reduces it down to about a 12 point text but if the field only contains 12 characters then I want the text to be a full 16 pt.>


this line
Me.txtCustomer.FontSize = IIf(Len(Me.txtCustomer.Value) > 12, 12, 16)

will follow the logic  if number of characters > 12  font size is 12 else font size is 16

is this what you want?
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

Author Comment

by:SteveL13
ID: 24344245
In other words, I'd like the text to dynamically fill the locked size of the text box on the report.
0
 

Author Comment

by:SteveL13
ID: 24344301
The code you provided is doing exactly what I would expect it to do but I probably didn't explain what I want well enough.  What I really want is to have the data fill the text box dynamically but not to exceed 16 point type size.  Can this be done?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 24344438
<What I really want is to have the data fill the text box dynamically but not to exceed 16 point type size>

i wouldn't even dare to start doing that..
0
 
LVL 34

Expert Comment

by:jefftwilley
ID: 24348581
I've done something like this

Select Case True
        Case lngArtist < 12
           Me.ARTIST.Properties("FontSize") = 16
        Case lngArtist < 14
           Me.ARTIST.Properties("FontSize") = 14
        Case lngArtist < 16
           Me.ARTIST.Properties("FontSize") = 12
        Case lngArtist < 18
           Me.ARTIST.Properties("FontSize") = 11
        Case lngArtist < 20
           Me.ARTIST.Properties("FontSize") = 10
        Case lngArtist < 22
           Me.ARTIST.Properties("FontSize") = 9
        Case lngArtist < 24
           Me.ARTIST.Properties("FontSize") = 8
        Case Else
           Me.ARTIST.Properties("FontSize") = 8
End Select

it is based on how many characters for a particular font fit into a fixed text box.

J
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 24348602
hi jeff,

looks like an exploded version of the the IIF(...) i posted above.



0
 
LVL 34

Expert Comment

by:jefftwilley
ID: 24351346
Hey Cap!
I used this for a set of reports that I created to make Karaoke song selection lists. The song titles and artist names are all various lengths. I don't remember the font nor the size of the textbox, but I measured how many characters fit into a specific space. I'm sure the lengths vary for different fonts. But the method works.
Good to see you!
J
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
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 …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

649 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