Locked lesson.
About this lesson
Modify the form created in the previous lesson, set properties and add controls.
Exercise files
Download this lesson’s related exercise files.
Services_04_Start.accdb708 KB Services_04_End.accdb
584 KB
Quick reference
Modify Form, Add Controls
Application Terminology
Add Fields
To add new textbox controls for fields to a form, click Add Existing Fields from the Design ribbon when you are in Form Design View. Resize the field list by dragging its borders. Drag fields from the field list to the form.
Select multiple fields in the field list by clicking the first one and shift-clicking additional fields.
Align Controls
To align controls with each other, select the desired controls, right-click on the selection, and choose Align > Left/Top/Right/Bottom from the shortcut menu.
Caption Property
For a label, the Caption property shows what will be displayed in the control. Users see captions.
Combo Box Control
A Combo Box show a list of choices from a different table than the one you are entering data into.
To change a textbox control to a combo box, right-click on it in Design View and choose:
Change To > Combo Box.
Set properties of the combo box to tell Access where the data will come from for the list, what columns will show, how wide each column will be, and how wide the list will be.
The main properties to set for a combo box are: Row Source on the Data tab, and on the Format tab: Column Count, Column Widths, and List Width. List Width is generally the sum of the column widths + 0.2 inches for a scrollbar. To hide a column, set its width to 0.
When you are looking at the data for a combo box, it is handy to open NotePad and record settings for properties.
Design View
The Design View of a form enables you to make changes such as adding and resizing controls. Yu cannot see data in this view.
Form Detail Section
The detail section appears once for every record and usually contains controls to show and edit your data.
Form Footer Section
The form footer section shows once at the bottom of a form. This a good place to put information that the user does not fill out like tracking fields (when a record was added and edited), and the primary key.
Form Header Section
The form header section shows once at the top of a form. This for a form title and, in the case of a multiple items form, the labels for each column.
Form View
The Form View of a form enables you to see the data, add, and edit.
Layout View
Layout View gives you limited design capabilities such as resizing and setting properties while you can see data.
Move Controls
To move controls, click and drag them. When controls are associated, such as a label and a textbox, they move together. To move associated controls independently, drag by the big handle in the upper left corner.
Name Property
Every control has a name that will be used to refer to the control. Users do not see the control names.
Resize Controls
To resize controls, drag a resizing handle on one of the sides.
Resize Sections
To close up space in a form section, move the mouse to the bottom of the section. When the mouse shape changes to a horizontal line with a double-headed vertical arrow, click and drag up.
To close space from the right side of a form, move the mouse to the right edge. When the mouse shape changes to a vertical line with a double-headed horizontal arrow, click and drag to the left.
Ruler
To toggle the display of the horizontal and vertical rulers on and off, right-click on a section bar and choose Ruler from the shortcut menu.
Select Multiple Controls
To select multiple controls, click on the first one and shift-click other controls to toggle them in or out of the selection.
Use the vertical and horizontal rulers to select multiple controls. When you click (and optionally drag), any control that the imaginary line (or rectangle) touches will be selected when you let go of the mouse.
Tracking Fields
Tracking fields are fields that the system fills in such as when a record was added and when it was edited.
Width Property
The width of a control will be stored in dimensions local to your region such as inches or centimeters.
Steps
Turn on Rulers
- In Design View of a Form or Report, right-click on a blank area
- Toggle the display of the Rulers on or off using the shortcut menu
Select Controls Using Vertical Ruler
- In Design View of a Form or Report, move mouse to the Vertical Ruler at the position of the controls you want to select
- Click and note the imaginary line going across at the position where you see
- Everything the line touches will be selected when you let go of the mouse
- Alternately, you can click and drag
to select controls that the imaginary rectangle touches.
Resize Section
- In Design View of a Form or Report, move the mouse to the bottom boundary of a section
- Click and Drag when the shape of the mouse pointer changes to
Basic Control Properties for Positioning
- Left
- Top
- Width
- 00:04 Hi, this is Crystal.
- 00:06 This is lesson 4 of Microsoft Access 2013 desktop databases.
- 00:11 In Lesson 3, we started building a Multiple Items form
- 00:15 to enter Services.
- 00:17 We changed the textbox control for service type
- 00:20 to a combo box so we could see a list of choices
- 00:23 from the service types table.
- 00:25 We could also change the time type ID to a combo box.
- 00:29 Switch to Design View.
- 00:32 Right-click on time type ID and choose
- 00:35 Change To > Combo Box.
- 00:37 Just as we did in lesson 3, we are going to
- 00:40 set properties for the combo box
- 00:44 We'll tell Access where the data will come from for the list,
- 00:47 how many columns it will have,
- 00:49 how wide each column will be,
- 00:51 and how wide the list will be.
- 00:53 Click on the Data tab of the Property Sheet.
- 00:56 Click in the RowSource property
- 00:59 and then on the Builder Button (...).
- 01:01 This time, I didn't choose the table first
- 01:03 so Access asks which table I want to use.
- 01:07 I pick the TimeTypes table and
- 01:09 then close the Show Table dialog box.
- 01:12 Double-click the ID field and the text field
- 01:15 from the fieldlist to put them on the grid.
- 01:18 Sort in Ascending order by the text field.
- 01:21 Click on the Datasheet icon to view the data.
- 01:24 It looks good.
- 01:25 While you can see the data,
- 01:27 make a note of how many columns there are
- 01:29 and how wide they should be.
- 01:31 I often pop up Notepad and
- 01:33 write the values I will paste into the properties.
- 01:37 Click the Close button and Yes to save the changes.
- 01:41 On the Format tab of the Property Sheet,
- 01:43 set the Column Count to 2,
- 01:45 Column widths to 0;1 and the
- 01:49 ListWidth to 1.2 inches, which is
- 01:52 the sum of the column widths + 0.2 inches for a scroll bar.
- 01:57 This form has 3 sections.
- 01:59 The Form Header section displays once at the top of the form.
- 02:04 The Form Footer displays once at the bottom of the form.
- 02:07 Right now it is empty.
- 02:09 We will add controls to it in this lesson.
- 02:12 The Detail section displays for every record.
- 02:15 The Detail section has a little bit too much space.
- 02:20 Move the mouse to the bottom border of the detail section.
- 02:23 Note the horizontal line and double-headed vertical arrow.
- 02:27 Close up the extra space by clicking and dragging.
- 02:31 Lets remove ServiceID so we can show it in the form footer.
- 02:35 Click the textbox and shift-click the label,
- 02:39 and press DELETE on the keyboard.
- 02:41 On the Design ribbon, choose Add Existing Fields.
- 02:45 The Property Sheet gets replaced with a fieldlist.
- 02:47 Expand the fieldlist by dragging its borders.
- 02:51 In the fieldlist, click dtmAdd, shift-click dtmEdit,
- 02:56 and drag the 2 fields to the form footer area.
- 03:00 Now drag ServiceID from the fieldlist
- 03:02 to the form footer area.
- 03:04 Move controls on the form by selecting them
- 03:07 and dragging them.
- 03:08 When you click on a control to select it,
- 03:11 there may be an associated label that gets selected.
- 03:15 Each textbox and corresponding label move together.
- 03:19 If you want to move the label and the textbox independently,
- 03:23 drag by the big square in the upper left corner.
- 03:26 Click the Property Sheet icon and
- 03:29 set the Width of each of the tracking dates to be 1.5 inches.
- 03:34 dtmAdd is the date/time a record was added.
- 03:37 It has a Default Value in the table design to be Now()
- 03:41 so it will be automatically filled out
- 03:43 with the current date and time.
- 03:46 dtmEdit is the date/time a record was edited.
- 03:49 It also starts out with a Default Value.
- 03:52 I like to put tracking fields and primary key fields
- 03:55 in the form footer.
- 03:57 Align the data to the left of each control
- 04:00 and the labels to the right.
- 04:02 Select all the controls in the form footer
- 04:04 by clicking in the vertical ruler.
- 04:07 Note the imaginary line going across.
- 04:09 Everything it touches will be selected
- 04:11 when I let go of the mouse.
- 04:13 I right-click on the selection and
- 04:15 choose Align > Top and then Align > Left
- 04:19 from the shortcut menu.
- 04:21 I close the extra space
- 04:23 by moving the mouse to the bottom of the section.
- 04:25 When the mouse cursor changes to a resizing arrow,
- 04:28 I click and drag the bottom border up.
- 04:30 Do the same for the right border of the form.
- 04:33 Click the Form View icon to see how things look.
- 04:37 They could do with a little adjustment.
- 04:39 Let's use the Layout View, which lets you
- 04:41 resize controls while you look at the data.
- 04:45 The Service Type could be wider so
- 04:47 click and drag its right border.
- 04:49 On the Property Sheet, I see it is 1.6042" wide.
- 04:55 Change this an even 1.75 inches.
- 05:00 The order control does not need to be so wide.
- 05:03 It just has a number to use for sorting.
- 05:06 I change the Width to 0.5 inches,
- 05:09 and the Caption of the label to Order,
- 05:14 and the Name of the label to Label_OrdrServ.
- 05:18 The ALL tab of the Property Sheet shows the
- 05:21 control Name and Caption right next to each other for labels.
- 05:25 I change the other label Captions and Names.
- 05:28 The user will see Captions but not control names.
- 05:32 Later, when we do more with automation,
- 05:34 Names will become important.
- 05:36 For now, we will make sure the controls have logical names.
- 05:40 Forms not only enable you to edit data in tables
- 05:44 better than opening tables directly,
- 05:46 but they also open doors to a lot of power.
- 05:50 You can use formatting and also automatation.
- 05:54 In the next lesson, we will change colors,
- 05:56 add a command button,
- 05:58 and create a macro to close the form.
Lesson notes are only available for subscribers.