Forms & Reports:
Controls

Title: Jan's Illustrated Computer Literacy 101
Did you want: Working with Databases: Access 2007, 2010, 2013, 2016


Whether you create your form with AutoForm, the Form Wizard, or manually, your form is made up of controls and their labels.

Controls

A control is an object on a form or report or data access page that displays data or controls an action or is a decoration like a line or an image.

  • Bound control - shows value from an underlying field

  • Unbound control - not tied to a field. Includes decorative lines and shapes, images, and an unbound label, like a title or directions for using a form.

  • Calculated control - uses an expression as its data source

Bound and unbound controls

Examples of types of controls, based on source
The Calculated control Full Name combines fields with an expression:
=IIf([Called] Is Null,[FirstName] & " " & [LastName],[Called] & " " & [LastName])

Previously in Access Basics, you did just a little bit of formatting of the controls on an AutoForm:

  • Select and move a control in Design View

  • Resize a control in Design View

In this lesson you will learn more about how to format controls and their labels.


Where you are:
JegsWorks > Lessons > Databases

Before you start...

Project 1: Intro

Project 2: Access Basics

Project 3: Tables & Queries

Project 4: Forms & Reports Arrow: subtopic open
    Import/Export/LinkTo subtopics
    Designing Forms Arrow: subtopic open
    Icon: StepForm Wizard
    Icon: StepControls
    Icon: StepCreate Form Manually
    Icon: StepFormat Form
    Icon: StepTab Control
    Icon: StepForm View
        Images in Forms & Reports
    Icon: StepForm Images
    Icon: StepRecord Images
    Icon: StepPrintable Form
    Designing ReportsTo subtopics
    Special Forms & ReportsTo subtopics
    Summary
    Quiz
    ExercisesTo subtopics


Search  
Glossary
  
Appendix



Button: Views - Design View (2003) Form Design View

Form Design View with labeled partsIn the Form Design View you can change the source, layout, and behavior of the form. You do not change the records themselves in this view, so you are free to play around with everything about the form.

What you can choose:

  • Tables or queries to use as the source
  • Which fields to use from the Field List
  • Type of control for each field
  • What sections to show:
    • Form Header/Footer
    • Page Header/Footer (only for printing)
    • Detail - the records!
  • Format for any part of the form
    • Position and size of all parts
    • Fonts, font colors, font sizes
    • Border size, border color
    • Background color or image
    • Titles and unattached labels
    • Decorative lines and images
    • Tabbed pages
  • Include another form as a subform
  • Assign responses to actions like clicking on a control or closing the form.

Dialog: Form PropertiesProperties Dialog Button: Properties:
The form, each of its sections, and each control has its own properties, which you can see in the Properties dialog. You open this dialog with the Properties button Button: Properties. It will stay open until you close it. The dialog will automatically change to match whatever is currently selected.

The properties that are available and the tabs displayed in this dialog vary, depending on what is selected. You will usually see tabs for Format, Data, Event, and All. The tab All lists all available properties for the selected object. Some properties can also be changed from the toolbar or through other dialogs.


Menu: View | GridWhat are the dots?
The background of the form in Design View has a grid of dots and lines. The  grid is there to help you get the controls and labels lined up neatly, but it can be annoying. The labels are often hard to read in this view! The grid can be turned off from the menu,  View | Grid .

Grid dots showing on a form  Grid dots not showing on a form

Form View with and without grid showing


Types of Controls

Toolbar: ToolboxThe Toolbox Bar is usually docked at the left edge of the window.Toolbar for Controls = Toolbox
The Toolbox toolbar has buttons for each of the types of controls that you can create while in Design View.

The Toolbox is docked at the left of the window by default. It can also float as a separate palette. The buttons are the same for Form and Report Design View. They are a little different for Page Design View.

Icon: Mouse click Click on each button in the image of the a bar below. A short explanation about what the button does will appear in a separate window. You can switch back and forth between that window and this one, or you can use the Next button in the new window to go through all the buttons in order for that toolbar.

Select Objects Control Wizard Label Text Box Option Group, Toggle Button, Option Button, Checkbox Combo Box, List Box Command Button Image Unbound Object Frame, Bound Object Frame Page Break Tab Control Subform or Subreport Line Rectangle More Tools Toolbar Options Handle Toolbar: Toolbox

OR

Icon: Mouse clickView all the descriptions for the buttons on a single page

Examples of types of controls


Names of Controls

Dialog: Properties for a text box: NameThe default Name for a data control is the field that is its Control Source, like StudentID or FirstName.


 

Dialog: Properties of a labelThe default name for other controls is the control type plus a number, like Image12, Label3, Box25, Option23, or Line52.

The number part of such a control name will be the next number after the total number of controls already added to the form. The numbering includes any objects that you have deleted.

Labels have a Caption property, which is just the text that shows on the form.

You can change the name of any control, if you wish.

WarningNames of Calculated Controls: If you are using an expression to calculate a control, the name of the control must not be the same as a field that is used in the expression. Doing so creates an error called a circular reference.
 


Selecting a Control

A control is an object that displays data or controls an action or is a decoration like a line or an image. We often refer to  a "control and its label", but a label is actually a type of control itself. A label is attached to a control. It's a bit confusing!

Control selectedLabel selectedTo select a control:

  • Click on it
  • Use the TAB key to move to it
  • Drag across it.
     

To unselect a control: Click somewhere that is not selected.

Handles (black squares) appear at the corners and the middle of each side when the object is selected.  There are two sizes of handles for two different purposes.

Resize handles: Drag on the smaller handles to change the width and height of the object.

Move handle: Drag the larger upper left handle to move the selected object separately from others in the selection. You don't lose the selection. A happy difference from most programs! This is the handle you will use to adjust the space between a control and its attached label.

Special Case: Control and Its Label
When you select a control, its attached label is not selected, but it does automatically get a Move handle at its upper left corner. Similarly, if you select a label, the control to which it is attached automatically gets a Move handle. Of course, you can select both of them when you need to with one of the methods described the next lesson Format Multiple Controls.

Label Text:
By default, the text in the label for a control is the name of the field. You can edit or even delete a label without affecting the values that show up in the control. You can edit the label text in several ways:

  • In Form Design View: Select the label; click it again; the cursor appears and you can now edit the text.
  • In the Properties dialog: Name property for the control
  • In the Table Design View: Caption property for the field

Label ready for editing Dialog: Properties - Name property for a control Table Design View: Caption property for a field
 


Moving Selected Control:

Control moved separately from its labelMove Separately Pointer: Hand pointing:
When your mouse is over the large handle at the upper left corner of an object, the pointer changes to the shape of a hand pointing Pointer: Hand pointing. Dragging with this shape moves that object by itself.
 

Control and its label moved togetherMove Together Pointer: Hand:
When the mouse is over the border of a selected object, the pointer changes to a whole hand. Dragging will move a control and its attached label together even though they are not both "selected".
 


Copy Formatting: Format Painter Button: Format Painter (2003)

Like other MS Office programs, Access includes the Format Painter tool. This button lets you copy formatting from one control to another.  Unlike other MS Office programs, you cannot drag across what you want to format. You must click on each control separately.

How to use Format Painter:

  • Format a control or label

  • Select it.

  • Click the Format Painter button Button: Format Painter (2003). The mouse pointer changes to the Format Painter shape Pointer: Format Painter.

  • Click another control to change its formatting to match. The mouse pointer returns to the Select shapePointer: Select.

When you want to format multiple objects, you can double-click the Format Painter button. The pointer will stay in the Format Painter shape so that you can click on various objects, until you click the button again.

Microsoft Access copies only the following properties with Format Painter:

  • BackColor

  • BackStyle

  • BorderColor

  • BorderStyle

  • BorderWidth

  • DisplayWhen

  • FontItalic

  • FontName

  • FontSize

  • FontUnderline

  • FontWeight

  • ForeColor

  • LabelAlign

  • LabelX

  • LabelY

  • LineSlant

  • SpecialEffect

  • TextAlign

  • Visible


Icon: Step-by-Step 

Step-by-Step: Format a Control

 Icon: Step-by-Step

What you will learn:

to select a control
to format control's appearance
to use Format Painter
to resize control
to move control
to add Form Header

Start with:  Class diskresource files, worldtravel.mdb from the previous lesson

You will work with the form from the previous lesson, Form Wizard. While the Form Wizard created a formatted form quickly, you will soon see that it can take a lot of work to make the form truly useful.

  1. Form View: StaffIf necessary, open the database worldtravel.mdb and open the form Staff, which you created in the previous lesson.
    This form need some changes to make it useable! It's crowded and the text boxes for data and their labels are not wide enough to show what is in them.
     

  2. Icon: Design Switch  to Form Design View.
    The design window shows a section bar for Form Header but apparently there is nothing worth showing!
     

    Form Design View: Staff

    Form Design View with Field List and Properties dialog
     

  3. From the menu select  View | Form Header/Footer  so we won't have to look at that unnecessary section bar.


Format Single Control

Let's experiment a bit with the formatting for just one control. Once you have found a good combination you can apply it to other controls.

  1. Label selectedSelect label:
    Click
    on the label Photo to select it.
    Handles appear at the corners and sides of the label.
    The control below the label gets only a Move handle which overlaps the Resize handle for the label. This makes the handles look a bit odd!
     

  2. Label resized to fit textLabel selected. Pointer as Resize Horizontal.Size label to fit: Mouse
    Move
    the mouse pointer over the Resize handle in the middle of the right edge of the label. The pointer changes to the Resize Horizontal shape Pointer: Resize horizontal
    Double-click.
    The label resizes itself to fit the text. This label was far too narrow! The text is Photograph, not just Photo.
    TipYou cannot size controls with data "to fit", only labels.
     

  3. Control resizedSelected control with pointer as Resize VerticalResize control:
    Click
    on the control below the label to select it.
    Move
    the mouse pointer over the Resize handle in the middle of the bottom edge of the control. The pointer changes to the Resize Vertical shape Pointer: Resize Vertical.
    Drag upwards until the control is approximately square and then release. The control is resized.
     

  4. Control HealthIssues selected. Pointer in Move Separately shape.Move control separately:
    If you resize other labels to fit, they will be underneath their controls. How do you move a control out of the way??
    Click on the control HealthIssues to select it.
    Move
    your mouse pointer over the Move handle for the control and drag it down below the bottom edge of the label.
     

  5. Label resizedSize label to fit: Menu
    Select
    the label for the HealthIssues control.
    From the menu select  Format | Size | To Fit
    The label expands to fit the text. The selection does not change.
     

  6. Edit label:
    Label in Edit modeClick
    in the label again, while it is still selected.
    The label changes to Edit mode, with reverse color for the background.
    Use the arrow keys as necessary to put the insertion point between the h and I.
    Edited label, no longer selectedPress
    the spacebar, which creates two separate words.
    Click out to remove the selection.
     

  7. Icon: Save From the menu select Save As and save the form with a new name, Staff-format single.

    tipActive form's title: The form that is open is now the copy that you just saved, as the Title bar shows in Design View.  Title bar in Form Design View: 'Staff-format single:Form'
    But, in Form View, the title bar still shows what is in the form's Caption property. Form View: Title bar showing Caption property
    This can be confusing!
     


Format Control and Label

You can change the look of a control or of its label or of both. You have MANY choices for colors, fonts, font sizes, borders, and special effects. Rather than walk you through a bunch of choices, this time you get to play around with it yourself!

  1. Icon: Experiment Experiment: Using the Health Issues control and its label, experiment with various choices from the toolbar and menus: font, font size, color, special effect, border, background, etc. You are looking for combinations that are more readable than what the Form Wizard created. You may need to resize the label again. You may want to apply some changes to just the label or to just the control.
     

  2. Switch to Form View and navigate to different records to see if your choices work well with the data.
     

  3. Icon: Save Once you have found a formatting combination that you like, save the form (with the same name Staff-format single). Your formatting will not likely be the same as another student's.
     


Format Painter

  1. Icon: Design Switch to Form Design View.
     

  2. Select the Health Issues control, which you formatted to suit yourself.
     

  3. Click on the Format Painter button Button: Format Painter (2003).
     

  4. Click on the DivisionID control at the bottom left of the form.
    The control and its label now match the formatting of the one you formatted, including the spacing between them.
    Was this a good choice?
    Moving the Health Issues control below its label was a good choice for that control, but not necessarily what you want for other controls.
     

  5. Make any needed changes to the DivisionID control so that the control and its label are readable. Consider whether or not you need to change the spacing or formatting or size.
     

  6. Select the DivisionID control and click the Format Painter button again.
     

  7. Click on the WorkPhone control, which is to the right of DivisionID.
    WorkPhone is now formatted like DivisionID.
    Icon: QuestionEvaluate: How is your formatting working out?
     

  8. Icon: Save Save your form again, with the same name, Staff-format single.


Create & Format Unbound Labels

It might be obvious to you today what your form is about. It helps new users to show a title. An unbound label is the type of control that you need.

  1. Form Design View: Form HeaderMenu: View | Form Header/FooterIn Form Design View, from the menu select  View | Form Header/Footer .
    Two new sections appear in the design, above and below the Detail section. You may want to resize the window for more work space.

    TipBe careful to choose the Form Header/Footer and not the Page Header/Footer, which will not show in Form View, only when printing.
     
    Icon: TroubleProblem: Form Header has no space
    If you got the section bar, that says "Form Header", but you do not see any space below it, move your mouse over the dividing line between the header and the detail sections until it changes to the Resize Vertical shape Pointer: Resize space vertically. Drag down. That will enlarge the section vertically.
     

  2. On the Toolbox toolbar at the left of the form, click on the Label button Button: Label - 2003.
     

  3. Move the mouse pointer over the blank Form Header. The pointer changes to a new shape, Draw LabelPointer: Draw Label.
     

  4. Initial label after clicking with pointer in Draw Label shape.Click in the Form Header. A tiny label is created, ready for your typing.
     
    TipYou can also drag while the pointer is in the Draw Label shape, to create a label of the size that you want. The size of the label does not affect the size of the text.
     

  5. Form Design View: after typing labelType World Travel Inc. in the label.
    The label automatically resizes as you type.
     
    You cannot format the label while it is in Edit mode.
     

  6. Form Design View: label deselectedClick out to deselect the label.
     

  7. Label World Travel Inc. after formatting. Cut off in the label box.Click the label World Travel Inc. again to select it.
     

  8. From the toolbar, format the label with:

    • Font: Matura MT Script Capitals

    • Font size: 20

    • Color: Green

    The label does not automatically resize to hold the text in its new size and font! You can, of course, resize the label "to fit".
     

  9. Label 'World Travel Inc.' resized to fitMove your mouse pointer over one of the Resize handles and double-click.
    The label resizes. The Form Header section will probably resize also, depending on exactly where your label was and how large it got. This is a helpful feature!

    If the header section did not resize, you may need to move the label up to the second row of grid dots and enlarge the header to match the illustration.
     

  10. Similarly, create a label to the right of World Travel Inc. and type into it the text Staff.
     

  11. Format the label Staff as :

    • Font: Tahoma

    • Font size: 16

    • Bold
       

  12. Form Design View: Label formattedResize the new label to fit.
     

  13. Move the labels so that they are positioned as in the illustration.

    World Travel Inc. is at the left edge of the layout and centered vertically in the Form Header.

    Staff is one grid row below top edge of the label World Travel Inc. and there are 4 grid dots between the labels.
     

  14. Switch to Form View to see how your form is looking now.
     

  15. Icon: Save Save your form again, with the same name, Staff-format single.
     

Form View: after managing header

For now, we will leave this version of the Staff form as it is, even though you have two controls formatted differently from the others and some controls are not a good size for the data. Later you will have a way to format this form to match a new one.


This lesson illustrates the advantages and difficulties of picking a complex AutoFormat early in the design process. All the controls have the same look but they are not sized for the data that you expect and it requires a lot of moving around. The controls appear on the form in the order that they are listed in the Table Design, which may not match the order that will be easiest to use.

In the next lesson you will create a form manually so that you will have more control over the process.