Controls Design Fundamentals
|
|
Adding Controls to
a Form or a Report
|
|
To select a control, you can click it in the Controls
section. Once a control, such as the button
 ,
has been clicked, it becomes highlighted
 .
If you clicked a control by mistake but want to use another, you can click
that other control. If you clicked a control but do not want to use any, you
can click the Select button

that is used to dismiss any selected control.
There are various techniques you can use to add a
control to your form or report:
- To add a control to a form or a report, you can click it and click
the form or the report. In the same way, you can add different controls
and as many as necessary
- If you will be adding a control many times, in the Controls section,
you can double-click it and click the form or report as many times as
necessary. To dismiss the control, you can click the Select button

- To add a control without clicking the form or report, press and hold
Shift, then click the control as many times as necessary. When you have
reached the desired number of controls, release Shift
Some controls are meant to assist you with performing an
action on the form or report. To make this possible, the Controls section is
equipped with a Use Control Wizards button
 .
To access it, click the bottom arrow button on the right side of the
Controls section:
If the control is set to perform an action, to use that
action, the Use Control Wizards button must be selected or highlighted
 .
In this case, if you click a control and click the form or report, a wizard
would come up and you can use it to configure the desired behavior. We will
see examples in other sections and lessons. In some cases, you will not want
to use the wizard. For this reason, you should always check whether the Use
Control Wizards button is not selected
 .
You can click it to put it up to make sure the control's action is not
launched.
Practical
Learning: Adding Controls From the Ribbon
|
|
 |
In the following exercises, there is a 100%
guaranty that the objects on our form do not display as those on
your form. Therefore, the screenshots are provided only as a guide:
they are not showing how your form should or must appear. When we
would like you to have the same type of design, we will let you know
and we will show you. Based on this, follow only the instructions
and do not make any attempt to match our screenshots. |
- In the Controls section of the Ribbon, click the Text Box
and move the mouse to the form

- Click somewhere in the middle-center area of the form (do not make
any attempt to be precise)
- In the Controls section of the Ribbon, right-click the Toggle Button
and click Drop Multiple controls (to indicate that you will add it many
times)
- Click somewhere in the top-right section of the form (again, no need
for precision at this time)
- Click again in the lower right section of the form
- Again, click the middle-right section of the form
- On the Ribbon, click the Select button

- In the Controls section of the Ribbon, right-click the Button
and click Drop Multiple controls
- Click the form three times
- On the Ribbon, right-click the Button
and click Drop Multiple controls
- To save the form, press Ctrl + S
Using Rulers and Dimensions
|
|
To assist you with design, a form or a report in Design
View is equipped with two rulers, one horizontal in the top section and one
vertical in the left section. Since the rulers are dimensionally configured,
there are divisions inside of the rulers to assist you with some precision.
Between two numbered dimensions, there are 7 marks that
create 8 divisions. The mark in the middle, a little taller than the others,
represents the middle of two dimensions. In our lessons, the middle division
will be referred to as half. The first division on the right side of a
number represents 1/8 of a dimension, the 2nd represents 2/8 of a dimension,
the 3rd represents 3/8, and that is why the 4th represents 4/8. This is how
we will refer to these dimensions.
The rulers can be very useful during control design. If
you do not want to use them, you can remove or hide them. To do this:
- On the Ribbon, click Arrange. In the Sizing & Ordering section,
click the Size/Space button and click Ruler:
- Right-click the middle of the form or report and click Ruler
Here is an example of a form in Design View without the
rulers:
Because you can ignore the rulers during design, you
should leave them on.
Control Design and the Grid Lines
|
|
To assist you with setting the characteristics of a
control, a form or a report in Design View is equipped with grid lines on
its body:
If you do not want to use the grid lines, to remove or
hide them:
- On the Ribbon, click Arrange. In the Sizing & Ordering section,
click the Size/Space button and click Grid
- Right-click the form or the report and click Grid
Here is an example of a form in Design View without the
grid lines:
As we will see in the next sections, you should display
the grid lines because you can ignore them during design.
Data Fields Design
Techniques
|
|
In
Lesson 3, we saw
that you could automatically generate a form or a report using data from a
table. In this lesson, we have seen how to add controls from the Ribbon to a
form or report. By default, the controls from the Ribbon are not related to
any data of a table. When working on a database, most of the controls you
will use are meant to display data. When starting a form or report or while
designing it, if it is meant to display data from a table, you must specify
it.
Practical
Learning: Using Existing Fields of a Table or Query
|
|
- Open the Bethesda Car Rental1 database
- On the Ribbon, click Create
- In the Reports section, click Blank Report
- To switch the report to Design View, right-click it and click Design
View
While designing a form or report unrelated to a table,
if you decide that it must display data, you can specify the table that
holds that data. To do this, while in Design View, you can display the
Properties window for the form or report. Then, click the arrow of the
Record Source combo box and select a table. Here is an example:
After specifying the Record Source of a form or report,
the controls positioned on it, if any, are ready to show the values stored
in the table. To make this happen, you can first add unrelated controls, as
we saw earlier, to the form or report, then "link" those controls to the
columns of the Records Source's table. Microsoft Access provides another
technique.
Besides the Properties window that we introduced
earlier, another window that can assist you when designing a form or a
report is called the Field List. This window is useful only if the form or
the report is meant to display data from a table, that is, if the form or
report is not an unrelated object.
The Field List is a window that holds the names of
columns from the table specified as the Record Source. To display the Field
List, while the form or the report is in Design View, on the Ribbon, click
Design and, in the Tools section, if the Add Existing Fields button is
highlighted
 ,
this indicates that the Field List is already displaying. Otherwise, you can
click it
 .
This would open the Field List. Like the Properties window, the Field List
is dockable, meaning you can move it around the screen, and you can position
it either to the left or to the right sides of the Microsoft Access
interface.
The Properties window and the Field List share the same
window location. Consequently, when one is displaying, the other closes, and
vice versa. Based on this, to display the Properties window, you can either
double-click the button at the intersection of the rulers

or you can click the Property Sheet button

in the Tools section of the Design category of the Ribbon. If the Field List
was displaying, it would be replaced by the Properties window. To display
the Field List, as mentioned already, in the Tools section of the Design
category of the Ribbon, you can click the Add Existing Field button
 .
If the Properties window was displaying, it would be closed and replaced by
the Field List.
If you open the Field List for an unrelated form or
report, that is, a form or report whose Record Source is empty, the Field
List would appear blank:
If the Record Source of the form or report is already
specified, the Field List would show the list of the columns of the base
table. Here is an example:
When the Record Source of a form or report has been
specified, by default, the Field List displays only the columns of its base
table. Still, the Field List is equipped to show the columns of the various
tables of the current database. To show the columns of the other tables, on
the Field List, you can click the Show All Tables button.
Practical
Learning: Accessing the Fields List
|
|
- On the Ribbon, click Design if necessary.
If the Add Existing
Fields button is not highlighted
,
click it
.
On the form, double-click the button at the intersection of both rulers
to display the Properties window of the report
- In the Properties window, click the Data property page
- Click the arrow of the Record Source button and click Company
Assets
- On the Ribbon, click the Add Existing Fields button and notice that
the Field List is now equipped with fields
- To save the report, right-click the Report1 title bar and click Save
- Set the Name to Company Assets and press Enter
Adding Fields to
Forms and Reports
|
|
When designing a form or a report, one of the most usual
actions you will perform consists of inserting items from the Field List to
the form or the report. To add a field, you can drag it from the Field List
to the form or report. To drag many fields at the same time, first select
them.
To select all items at the same time on the Field List,
you can click the item on one end of the list, press and hold Shift, and
click the item on the other end. In fact, you can use this same technique to
select fields in a range.
To select fields at random, press and hold Ctrl, then
click each one of the desired fields. If you had selected an item but want
to remove it from the selection. While still holding Ctrl, you can click the
undesired item.
To add one item to the form or report, you can
drag it from the Field List and drop it on the form or the report.
Alternatively, you can double-click it from the Field List and it would be
positioned in the body of the form or report.
To add a group of items, first select them from the
Field List, then drag the selection and drop it on the form or report.
Practical
Learning: Inserting Fields
|
|
- The Company Assets report should still be opened in Design View with
the Field List
In the Field List, click Date Acquired and hold your
mouse down
- Then drag it (Date Acquired) from the Field List and drop it in the
middle left area of the report

- In the Field List, click Category
- Press and hold Shift, then click Model, and release Shift. This
allows you to select a range of fields
- Click and hold the mouse on the selection. Then drag and drop it
under the Date Acquired field on the report

- To select fields at random, in the Field List, click Purchase Price
- Press and hold Ctrl
- Click CompanyAssetID
- Release Ctrl
- Click and hold the mouse on one of the selected items, such as
Purchase Price
- Drag and drop in the upper right area of the report
- To save the report, press Ctrl + S
- In the Ribbon, click Create and, in the Forms section, click Blank
Form
- To save the form, right-click its title bar and click Save
- Set the Name to Company Assets1 and press Enter
- To switch it to Design View, right-click its title bar and click
Design View
- Using the Properties window, set its Record Source to Company Assets
- Display the Field List.
From the Field List, double-click the
items in the following order: Date Acquired, Category, Make, Model,
CompanyAssetID, and Purchase Price
- Save and close the form
- Open the Yugo National Bank1 database
- Using the Table button in the Create section of the Ribbon, start a
a table. After the ID column, using the Add New Field, create the
following columns: TransactionType and Description.
- Rename the first column from ID to TransactionTypeID.
- Save the table as TransactionTypes and close it
- Open the World Statistics1 database
- Use the Table button in the Tables section of the Ribbon to create a
new table with the following fields: ContinentID,
ContinentName
- Save the table as Continents and switch it to Design View
|
No comments:
Post a Comment