Home  Fees/Services  Access Examples  Tutorials  Access Download  Articles  Search  Contact  Privacy  Links

Access Form Programming Tutorial
Change Height/Width/Position of Form Field







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



Our programming team has 15 members containing a wide variety of technical database knowledge and programming experience. Experts in small business management and scientific database programming.

Do you and your clients need access to data on the Internet? We can create a secure system to match your requirements perfectly.


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

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.









A Blue Claw Software Design Template:

Airline Reservations Database Template
 








A Blue Claw Database Design Article:

Learn How To Select A Consultant
 









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




Contact Information

Copyright 2000-2017 Blue Claw Database Design