Link to home
Start Free TrialLog in
Avatar of SteveL13
SteveL13Flag for United States of America

asked on

How make data in a text field dynamically change size to fit the size of the text field?

I have a field on a report that cannot be set to grow due to restrictions of the overall report size..  But I want the text in the field to be set at 16 pt. size by default but reduce in size to fit the size of the text box when necessary.  Can this be done?
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

try something like this,  (not a perfect solution)
place the codes in the Format event of the Section where the textbox is.
if text box is in the Detail section, use

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
select case len(me.textboxname)
       case is < 25
            me.textboxname.fontsize=12
       case is < 15
           me.textboxname.fontsize=16

        case else
end select
end sub

you have to do several  test to find whic setting will work for you
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SteveL13

ASKER

With greater it worked.

    Select Case Len(Me.txtMetal)
        Case Is < 25
             Me.txtMetal.FontSize = 15
        Case Is > 25
            Me.txtMetal.FontSize = 10
        Case Else
    End Select