Increase Height of Text Box

 

Increase Textbox Height

Make Text Field Bigger/Smaller at Run Time

Making a text box taller temporarily makes using an Access form a lot easier.  With a double click event on the form field we’ll show you the VBA code needed to make the field taller so you can see more text all at once.  When you are done reading you can double click again to shrink it down to normal size.  Here is a form:

Note that this is a continuous form (not that it matters much) and also the CanGrow property has no affect on this.

In this example we would like to see more text for the Descr field.  We created a double click event which runs the following Visual Basic code:

Private Sub Item_Descr_DblClick(Cancel As Integer)
If Me.ActiveControl.Height = 446 Then
Me.ActiveControl.Height = 2500
Else
Me.ActiveControl.Height = 446
End If
End Sub

Note that the normal height of the text field is 446 (TWIPS I think).  When we start out we determine the height by temporarily adding a message box in the beginning of the code…

Msgbox Me.ActiveControl.Height

When you first do the double click the code will popup the value for the height of the text field.  After that  you can remove the msgbox code.

You can also calculate the number of TWIPS for the normal field and for the number of TWIPS you want for the expanded field.  In the property sheet of the textbox field you’ll find the Height property.  Height in the property sheet is usually displayed in inches (USA) or centimeters (Metric).  If you multiply the number of inches, in my case .3097 * 1440 you get 446 you see where the numbers came from.

Back to the form at runtime… after double click the expanded textbox looks as follows:

You can create similar code to change the width/length of a text box or control, also the top position and move textbox left/right/up/down,  This technique works on Forms and Reports.

Microsoft Office Forms:
MS Access 2003
Access 2007
Access 2010
Access 2013

 

Microsoft Office VBA, MS Access 2003, 2007, 2010, 2013, 2016