Access Report with dynamically changing text box size

10,831

Solution 1

I would advise you to set a your text box size to what you think is optimum and use the CanShrink and CanGrow properties (tap the text box and then open the properties windows and you can find them there).

The CanGrow property indicates whether the size of the text box can increase vertically according to its content. Similarly, CanShrink decreases the height of the text box according to its content. Here is a link for better understanding these two properties.

Solution 2

Use the Detail_Format event.

It fires before each line, and you can change the formatting based on the length of the text.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If Len(Field1) < 10 Then
        txtField1.FontSize = 18
    Else
        txtField1.FontSize = 12
    End If
End Sub
Share:
10,831

Related videos on Youtube

Kaja
Author by

Kaja

Updated on July 12, 2022

Comments

  • Kaja
    Kaja almost 2 years

    Is it possible to have a report with flexible text width and height? I sometimes have two words in this text and some times hundreds. I want to have small text for the first and big text for the second. How do I do that?

  • Mark C.
    Mark C. over 9 years
    See the question title in supplement to your answer. Changing text box size and OP also wants to have small text in the first and big one in the second.