<%dim crumb,crumb1 crumb="Make Control/TextBox Change size" crumb1="Change Height/Width/Position of Form Field" %> Increase Height of Text Box
Home  Fees/Services  Access Examples  Tutorials  Access Download  Articles  Search  Contact  Privacy  Links

Access Form Programming Tutorial
<% response.write crumb1 %>

Home > Microsoft Access Tutorials > Access Forms Tutorial <% response.write ">" & crumb %>
<% Gnum="9096031968" Ynum="7841" dim Page_Type Page_Type="Prog" response.write "" %>

Form Subtotal Fields
Master/Detail Forms
NotInList Event
Speed Up Forms
Unbound Form
Change Textbox Height
Get Website Data
Access Audit Trail

Form Query Parameter

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:

Change Textbox Size At Runtime

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
    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:

Resize Textbox

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

Contact Information

<% Response.write "Copyright 2000-" & year(now) & " Blue Claw Database Design" %>