Home

Details on Controls Design

 

Control Selection

 

Selecting One Control

After adding a control to a form or report in Design View, to manipulate it, you can first select the control. To select a control:

Control Selection

The Properties of a Selected Control

A control that is selected displays 8 handles around its body with the top-left handle thicker than the others:

The Handles of a Button

When a control is selected on the form or report, the Properties window shows only its characteristics and you can change only the characteristics of the selected control:

The Properties of a Selected Control

Notice that the combo box in the Properties window displays the name of the selected control.

Practical Learning: Startinge the Lesson

  1. Start Microsoft Access
  2. Open the Exercise2 database from the previous lesson
  3. In the Navigation Pane, right-click the Central form and click Design View

Selecting Various Controls

To select more than one control, at random, click one, then press and hold Shift. While holding Shift, click each of the desired controls. After selecting the controls, release Shift.

To select controls aligned vertically, click inside of the horizontal ruler above the highest positioned control. Everything that would be touched by the fake line will be selected:

Selecting Horizontally Aligned Controls

Selecting Horizontally Aligned Controls

In the same way, you can select controls that are horizontally aligned by clicking inside the vertical ruler. 

To select many controls in the same area on the form, click next to one of them and draw a fake rectangle that covers each of the desired controls:

Drawing a Rectangle to Select Controls

All controls touched by the fake rectangle would be selected when you release the mouse

Drawing a Rectangle to Select Controls

To select all controls on the form or report, you can press Ctrl + A. You can also click inside of one of the rulers on one end and drag to the other end. After selecting the controls, you can change the common properties of the selected controls.

To remove a control from a group of selected controls, press and hold Shift, then click the undesired control of the group. You can include an object back in the group by pressing Shift and clicking the control.

To dismiss a group of selected controls, you can simply click an unoccupied area of the form or report. In some cases, you may have removed a control from the group by mistake or you may have dismissed the group by mistake while you still need it.

If you have a group of controls that you will use over and over again, you can include them in a formal group so that, even if you click an unoccupied area of the form or report, the group would have been saved and you can get it back when needed.

To create and save a group of controls, first select the group. Then, on the Ribbon, click Arrange. In the Sizing & Ordering section, click the Size/Space button and click Group Group:

Grouping Items

Remember that controls you want to select do not have to be adjacent. If you click an unoccupied area of the form or report, the selection would disappear but the group would have been saved. If you click any control of the group, the controls that belong to the group would be selection again to indicate that the selected controls are part of a group. When you do not need the group anymore, to dismiss it, on the Ribbon, click Arrange. In the Sizing & Ordering section, click the Size/Space button and click Ungroup .

When many controls are selected, the Properties window shows (only) the characteristics common to those controls:

Common Properties of Many Controls

This means that you can change the common characteristic(s) that many controls share and each would receive the change.

Practical Learning: Selecting Controls

  1. Click a button on the form. Notice that 8 handles surround it to indicate that is has been selected
  2. On the form, click the control that displays Unbound. Notice that although only the text box was selected, the corresponding label has its upper-left corner selected also
  3. Press Ctrl + A. Notice that all of the controls/items on the form have been selected:

    Form Design: Selecting all Controls
  4. To dismiss the selection, click an unoccupied area of the form
  5. Click the Unbound text box
  6. Press and hold Shift
  7. Click one of the toggle buttons
  8. Click one of the command buttons on the form
  9. Release Shift
  10. Notice that these controls have been selected at random
  11. Click an unoccupied area of the form
  12. Position the mouse inside of the horizontal ruler above the top toggle button until the mouse cursor turns into a down pointing arrow:
     
    Form Design: the Mouse in the Horizontal Ruler
  13. Click.
    Notice that all items under the mouse cursor when it was clicked have been selected
  14. Position the mouse inside of the horizontal ruler at 31/2 until the mouse cursor points down
  15. Click and hold your mouse at that position
  16. With your mouse still held, drag left until the mouse pointer is at 3/4
     
    Form Design: the Mouse in the Horizontal Ruler
  17. Release the mouse.
    Notice that all controls that were touched by the waving line have been selected
  18. Position the mouse inside of the vertical ruler to the left of one of the toggle buttons until the mouse pointer turns into a right pointing arrow:
     
    Ruler
  19. Click.
    Notice that everything horizontally positioned on the right side of the mouse pointer has been selected
  20. Position your mouse inside of the vertical ruler at 21/2 until the mouse turns into a right pointing arrow
  21.  Click and drag up until the mouse pointer reaches 5/8
     
    Control Selection
  22. Release the mouse.
    Notice that all controls on the right side of the covered area have been selected
  23. Click an empty area on the form to deselect
  24. Click and hold your mouse on an unoccupied area in the lower-right area of the form without touching any control
  25. While holding the mouse, drag up and left as if you were drawing a rectangle. While dragging, make sure your rectangle covers a few but not all controls
  26. Release the mouse.
    Notice that the controls that were touched have been selected
  27. Click an unoccupied area on the form to dismiss the selection
  28. Close Microsoft Access
  29. When asked whether you want to save, click Yes (it doesn't really matter)

The Location of a Control on a Form or a Report

 

The Top and Left Properties of a Control

When you add a control to a form or report, it takes a position on its host but it depends on the control. The location of a control is both:

In the Properties window, the distance between the top border of the form or report and the top border of the control is represented by the Top property. The distance between the left border of the form or report and the left border of the control is represented by the Left property:

The Location of a Control Within its Host

Moving Controls Randomly

After adding a control to a form or report, it assumes a position based on where you clicked but this may depend on the control. Most of the time, you will want to change the position. Moving a control consists of changing its location on the form or the report. There are various ways  you can do this.

 You can move a control along the grid lines or you can ignore them:

To move a control or a group of controls with even more precision, in the Properties window, you can change either or both the Left and the Top values.

Practical Learning: Moving Controls Randomly

  1. From the resources that accompany these lessons, open the Bethesda Car Rental1 database
  2. In the Navigation Pane, right-click the All Tables bar, position the mouse on Category, and click Object Type
  3. In the Forms section of the Navigation Pane, right-click the Company Assets form and click Design View
  4. On the Ribbon, click Arrange.
    In the Sizing & Ordering section, click the Size/Space button and make sure the Snap to Grid button is clicked Snap to Grid. Otherwise, click it
     

Moving Controls Vertically

 

Introduction

When a control has been selected, as your mouse moves over it, its pointer displays a different cursor. One of these cursors can be used to move a control. This cursor is represented as a cross with four arrows:

Moving

By default, when dragging the control(s), it(they) move(s) by one unit of the grid lines on the form or report and you can move left, right, up, or down but:

You can also move the controls vertically using the Properties window:

Practical Learning: Moving Controls Vertically

  1. Click the CompanyAssetID label on the form
  2. Position the mouse on the upper left corner of the selected label until the cross cursor appears:
     
    Control Selection
  3. Click and drag up and left to move the label so that its left border aligns with the 1/4 measure of the horizontal ruler and its top border aligns with the 1/8 measure of the vertical ruler:
     
    Selection 
  4. Release the mouse
  5. Save the form

Aligning Controls Vertically

Consider the following form:

Form Design: Control Alignment

One of the obvious problems is that this layout does not follow any reasonable logic. Among the remedies to this, you can better align the controls. For example, you may want the First Name label, the top Unbound text box, the MI label and its text box to have the same distance from the top border of the form. Aligning the controls consists of using a reference to position other controls based on this reference. Fortunately, Microsoft Access provides all the necessary tools to align the controls on a form or report.

To assist you with aligning the controls on a form or a report, the Ribbon provides the Control Formatting section in the Format tab. To access it, while the form or report is in Design View, on the Ribbon, click Format. You will see the section labeled Control Alignment:

Control Formatting

Before aligning some controls you must first decide which one would be used as a reference. This means that you can use the alignment of one control as a reference for the other controls. To do this, position that control as the others should be aligned vertically. For example, imagine that, from the above form, you want to position the First Name label, its text box, the MI label, and its text box to have the same distance from the top border of the form. You can start by positioning one of these control at the top distance you want. Here is an example:

Form Design: Positioning a Control Whose Top Alignment Would be Used as a Reference

After doing this, the alignment of such a control, in this case the top alignment of the First Name label, can be used to align the First Name text box, the MI label, and the MI text box. To align the other controls, first select them. Here is an example:

Form Design: Controls Selection

To align the controls:

Here is the result from the above selection:

Controls Alignment

In the same way, you can align other controls. You can also align controls to the bottom: first align the one that would be used as the reference, select the others, and click the Bottom button in the Control Alignment section of the Ribbon. You can also right-click one of the controls in the selection, position the mouse on Align, and click Bottom.

Practical Learning: Aligning Controls Vertically

  1. On the form, click the CompanyAssetID label to select it
  2. Press and hold Shift
  3. Click the CompanyAsset text box to have the label and the text box selected
     
    Moving
  4. On the Ribbon, click Arrange. In the Sizing & Ordering section, click Align and click Top
  5. Save the form

Moving Controls Horizontally

 

Introduction

Instead of moving the control(s) randomly or vertically, you can move it(them) horizontally only:

You can also move the controls horizontally using the Properties window:

Practical Learning: Moving Controls Horizontally

  1. On the form, click the Date Acquired text box
  2. Press and hold Shift
  3. Click the following text boxes: Category, Make, Model, and Purchase Price
  4. Release Shift
  5. Press the right arrow key 20 times
  6. Save the form

Aligning Controls Horizontally

Imagine you want to position some labels of the above form to the left. You can start by positioning the First Name label to the desired left distance:

Form Design: Positioning a Control Whose Alignment Would be Used as a Reference

After doing this, the alignment of such a control, in this case the First Name label, can be used as a reference for the others. To align the other controls, first select them. Here is an example:

Controls Alignment

Notice that only the controls that will be aligned, in this case only some labels, have been selected. To align them:

Here is the result from the above selection:

Control Alignment

In the same way, you can align other controls. You can also align controls to the right: first align the one that would be used as the reference, select the others, and click the Right button in the Control Alignment section of the Ribbon.

Practical Learning: Aligning Controls Horizontally

  1. On the form, click the CompanyAssetID label
  2. Press and hold Shift
  3. Click the following labels: Date Acquired, Category, Make, Model, and Purchase Price
  4. On the Ribbon, click Arrange if necessary. In the Sizing & Ordering section, click Align and click Left
     
    Align
  5. On the form, click the CompanyAsset text box
  6. Press and hold Shift
  7. Click the following text boxes: Date Acquired, Category, Make, Model, and Purchase Price
  8. Right-click Make (or one of the selected controls), position the mouse on Align, and click Left
     
    Controls Alignment
  9. Click the button at the intersection of the rulers
  10. Save the form

The Size of a Control

 

Introduction

The size of a control is both:

When you add a control to a form or report, it assumes a certain size depending on the type of control. In some cases, you will want to change the size the a control. Resizing a control consists of changing its measures. There are various ways  you can do this.

Resizing a Control

Resizing a control consists of changing either its width, its height, or both. Before resizing a control, first select it. To resize a selected control, position the mouse on one of its borders. When the mouse moves over a selected control and reaches one of the handles, the mouse pointer displays a double-arrow cursor. The possible mouse pointers are:

Cursor Role
Shrinks or heightens the control
Resizes the control in North-East <-> South-West direction
Narrows or widens the control
Resizes the control in North-West <-> South-East direction

Although these pointers can be used to resize one control, they can also be applied to a group of controls. Based on this:

Practical Learning: Resizing a Control

  1. On the form, click the CompanyAsset text box
  2. Position the mouse on the middle handle of its right border
     
    Controls Alignment
  3. Click and drag left until the right border of the text box aligns with  the 2 measure of the horizontal ruler
     
    Controls Alignment
  4. Release the mouse
     
    Control Resizing
  5. Save the form

Resizing Various Controls

Instead of one, you can also resize a group of controls at the same time:

To further assist you with resizing a control, Microsoft Access provides the Size/Space button of the Ribbon. To access it, while the form or report is in Design View, click Arrange. To resize a group of controls, first select one and set the desired size, such as the desired width. Consider the following form:

Controls Alignment

Imagine you would like the First Name text box, the Last Name text box, and the Gender combo box to have the same dimensions. First select the controls that will be resized:

Controls Alignment

To resize the controls:

Size

Ribbon Menu Name Shortcut Menu Description
Size to Fit Size to Fit To Fit The controls will be resized based on the contents of their value
Size to Grid Size to Grid To Grid The controls will be resized so their borders fit with the grid lines
Size to Tallest Size to Tallest To Tallest The heights of the selected controls will be increased to match the height of the tallest control
Size to Widest Size to Widest To Widest The widths of the selected controls will be increased to match the width of the widest control
Size to Shortest Size to Shortest To Shortest The heights of the selected controls will be decreased to match the height of the shortest control
Size to Narrowest Size to Narrowest To Narrowest The widths of the selected controls will be decreased to match the width of the narrowest control
 

Practical Learning:  Resizing Various Controls

  1. On the form, position the mouse inside the horizontal ruler at 1/2 and click to select the labels
  2. On the Ribbon, click Arrange if necessary.
    In the Sizing and Ordering section, click Size/Space and click To Widest
     
    Widest
  3. Save the form

The Width and the Height Properties of a Control

You can also resize a control or a group of controls using the Properties window. In the Properties window, the width of a control is represented by the Width property while the height of a control is represented by the Height field. Therefore, to resize a control with more precision, you can change either or both its Width and/or its Height properties. To resize a group of controls, first select them. In the Properties window, change either or both the values of the Width and/or the Height fields.

   
 

Previous Copyright © 2000-2016, FunctionX Next