Connecting Tech Pros Worldwide Forums | Help | Site Map

Auto fit text to a label

Newbie
 
Join Date: May 2007
Posts: 1
#1: May 2 '07
I want to dynamically resize text in a text box on an Access form. I did this several years ago, but have since forgotten how I did it. I even limited the font size to change between two sizes, such as 14 pt and 6 pt. This was very handy at times as one could often see everything without having to scroll.

Anyone have any ideas that can head me in the right direction?

Thanks,

Randy

Rabbit's Avatar
Expert
 
Join Date: Jan 2007
Location: California
Posts: 3,835
#2: May 2 '07

re: Auto fit text to a label


You probably used Len() to determine how long the string was and then used a smaller font size for anything above a threshhold value.
JConsulting's Avatar
Expert
 
Join Date: Apr 2007
Location: Houston
Posts: 601
#3: May 6 '07

re: Auto fit text to a label


something like this

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


Adjust to suit a particular font.
J
Reply