|
Remember that, when displaying data to a user, the form
shows in Form View, if you are designing, or modifying the design of, a
form, you must display it in Design View. In some cases, whether in Form
View or in Design View, a form is represented by a tab that displays an icon
 .
|
Practical
Learning: Introducing Forms and Reports' Properties
|
|
- Start Microsoft Access
- Open the Hotel Management1 database you started in the
previous lesson
- To create a new form, on the Ribbon, click Create and, in the
Forms section, click Blank Form
- To save the new form, right-click the Form1 tab and click Save
- Set the name to Central and press Enter
- To switch the form to Design View, on the right side of the status
bar, click the Design View button

- To access the properties of the form, double-click the button at
the intersection of the rulers

On the right side of its icon

,
by default, a form displays its name. In reality, the string on the right
side of the icon is called the caption of the form. The caption of a form
is recognized by the
Caption property. If you do not specify the
caption, the title bar of a form displays its name.
To specify the caption of a form, access its
Properties window and, in the Format or the All tab, click Caption
and type the desired string.
Practical
Learning: Specifying the Caption of a Form
|
|
- In the Properties window of the form, click the Format tab and
click Caption
- Type Main Switchboard and press Enter
- To save the form, press Ctrl + S
Tabbed Documents or Overlapped Windows?
|
|
We mentioned that a form was represented in its top
section by a tab. When a form displays with a tab, the right section of
the tab(s) displays a close button

that you can use to close the form.
If you want, you can replace the tab of a form and let
the form display without the tab. To do this, click File and click
Options. In the left frame of the Access Options dialog box, click Current
Database. In the right frame and in the Document Window Options section,
click the Tabbed Documents radio button and remove the check mark on the
Display Document Tabs check box, then click OK. On the message box that
appears, click OK. Close and reopen the database. By default, a form
displays with a tab, in which case the user cannot move it. Otherwise, a
form can appear as a regular window with its system buttons. To take care
of this, you can click File and click Options. In the left frame, you can
click Current Database and, in the right frame, in the Document Window
Options sections, click the Overlapping Windows radio button:
After making the selection, you can click OK. You will
be asked to close and reopen the database:
Which you should do.
If you display a form as overlapped, it would be
equipped with three system buttons

,

or

,

.
Here is an example:
The group of these buttons is called the Control
Box. If you do not want these system buttons at all, access the
Properties window of the form and set the Control Box Boolean
property to No from its Yes default value. In this case, the
form would appear with neither the system icon nor the system buttons. If
you do this, make sure the user has a way to close the form.
Like a regular window container, the form displays a
title bar in its top section. If the database is configured to show
overlapped windows, on the left side of the title bar, a form displays an
icon. The system icon is fixed and you should not spend time trying to
change it. The system icon holds a menu that allows the user to perform
the regular operations of a Windows container, including minimizing,
maximizing, restoring or closing the window. To display this menu, the
user can click the form's system icon:
The presence of the form's system icon is partly
controlled by the Control Box property of a form. In most cases,
you should make this system icon and its menu available to the user. If
for some reason you don't want to provide this functionality, set the
Control Box property to No. The form would appear as follows:
If you decide to do this, make sure you provide the
user with the ability to close the form and this type of title bar makes
it impossible. Of course, a user may know that the form can be closed by
pressing Ctrl + F4.
The middle section of the title bar is actually
referred to as the title bar. It can be used to change the view of the
form after right-clicking it.
 |
When designing your forms, try to keep
colors to their default and to their minimum. In this lesson, we
are showing most options simply to let you know that they exist,
not because you should or must change them. |
Instead of completely hiding all system buttons of a
form, you can specify which ones to display and thus control the ability
to close, minimize, or maximize the form. The presence and/or the role of
the system buttons is (partly) managed by the Control Box and the
Min Max Buttons properties. When the Control Box property is
set to No, regardless of the value of the Min Max Buttons
property, there would be no system buttons on the title bar. If you want
to control the appearance and behavior of the system buttons, the
Control Box property must be set to Yes. The values of the
Min Max Buttons produce the following results:
Min Max Buttons |
Result |
System Buttons |
Consequence |
Minimize |
Maximize |
Close |
None |
 |
Hidden |
Hidden |
Available |
The form can only be closed |
Min Enabled |
 |
Enabled |
Disabled |
Available |
The form can be minimized or closed but not
maximized |
Max Enabled |
 |
Disabled |
Enabled |
Available |
The form cannot be minimized but can be
maximized |
Both Enabled |
 |
Enabled |
Enabled |
Available |
All operations (minimize, maximize, restore,
and close) are allowed |
Depending on the role and probably the number of
Windows controls on a form, you will decide what button to allow or not.
Practical
Learning: Accessing the System Buttons of a Form
|
|
- Click File and click Options
- In the left frame, click Current Database
- In the right frame, in the Document Window Options, click the
Overlapping Windows radio button
- Click OK
- On the Microsoft Office Access message box, click OK
- Close Microsoft Access
- Restart Microsoft Access and re-open the Hotel Management1
database
- To reopen the Central form, in the Navigation Pane, right-click
Central and click Design View
Whether you allow the system icon and system buttons
or not, the user needs to be able to know where a form starts and where it
ends. This is seen by the borders of the form. In most cases, you will not
be concerned with this aspect. Otherwise, you can control the borders of a
form.
If a database is configured to show overlapped
windows, the borders of a form are controlled using the Border Style
property. If you set it to None, the form would appear without
borders.
Before using a form or performing an update in it, in
most cases, you probably would need to open it first but this may depend
on what you want to do at the time. This is because a form offers many
types of views. One of them in the Form View. Here is an example:
To open a form in Form View:
- If the form is currently closed, in the Navigation Pane,
double-click it
- If the form is currently opened but is displaying in a view other
than the Form View:
- Right-click its title bar and click Form View
- On the Ribbon, click the arrow of the View button and click
Form View
Another type of display of a form is called Layout
View. It shows how an object is visually positioned (laid out) on the
form:
The Layout View is available only if the objects on
the form are based on the columns of a table. To open a form in Layout
View:
- If the form is currently closed, right-click it in the Navigation
Pane and click Layout View
- If the form is currently opened but is displaying in a view other
than layout
- Right-click its title bar and click Layout View
- On the Ribbon, click the arrow of the View button and click
Layout View
One more view of the form is used to design or modify
the way a form looks. This is referred to as Design View:
To open a form in Design View:
- If the form is currently closed, right-click it in the Navigation
Pane and click Design View
- If the form is currently opened but is displaying in a view other
than the design:
- Right-click its title bar and click Design View
- On the Ribbon, click the arrow of the View button and click
Design View
The main area of the form is what the user will mostly
use. This is also referred to as the body of the form. If you create a
form using the Form Wizard, it (the wizard) can assist you with deciding
how the objects in the body of the form would display. Forms can be
designed in various flavors: Columnar, Datasheet, Tabular,
Justified. As another way to specify the view of a form, you can
display it in Design View. Then, in the Format or the All tab of the
Properties window, use the options in the Default View field:
A columnar form is used to display data one record at
a time. This is a convenient display for data entry and analysis because
the user is able to examine each piece of information for each one record:
A tabular form displays its data in a series of cells
following continuous sets of records. All or almost all records are
displaying in a single layout:
To create a tabular form, use the Form Wizard and
select its option. Otherwise, you can design a from from scratch. Then, in
the Format or the All tabs of the Properties window, set its Default
View to Continuous Form.
A Datasheet form looks and behaves like a table,
displaying all possible records at the same time instead of one record at
a time. A datasheet form is mainly used in relationships to display
another table's related records. It is also suitable for people who prefer
to work in a spreadsheet environment. This display allows the database
developer to provide a sheet view to the data entry personnel without
making the table's design or formats available.
You can make the same form available in Form View and
Datasheet View. In fact, most forms are. Users can switch from Form View
to Datasheet View by clicking the View menu.
To create a Datasheet form, use the Form Wizard and
select its option. You can also design a from from scratch. Then, in the
Format or the All tabs of the Properties window, set its Default View to
Datasheet.
A Justified form provides a consistent look with
borders added to labels.
A split form is made of two sections. The top section
displays like a normal Form View and shows one record at a time. The
bottom section displays a datasheet view of (all) the records (if the area
is big enough):
When using the split form, if you click a record in
the bottom section, its values display in the top section. To
automatically generate a split form, in the Navigation Pane, click the
table that holds the records. Then, on the Ribbon, click Create. In the
Forms section, click Split Form. To create a split form by design, start a
form in Design View or display an existing form in Design View. In the
Properties window of the form, set its Record Source to the table that
holds the value and set its Default Value to Split Form. If it is bran new
form without some previously created fields, use the Field List to add the
desired fields to it.
When it comes up, a form is presented as a rectangular
box. A form in Design View is made of a form selection button, two rulers,
two scroll bars, a horizontal bar labeled Detail, and a body. By default,
a form presents a section referred to as the Detail section. This section
starts from the Detail bar to the lower end of the section. The Detail bar
displays only when the form is in Design View.
The Detail section serves as the main host of other
controls. It can also serve to display messages of various kinds. The
Detail section can be enhanced by manipulating its properties. These
properties are not necessarily related to the parent form but can be used
conjointly with it.
We mentioned earlier that the form itself controls its
width. The vertical dimension of a form is controlled by its sections.
This means that a section, such as the Detail section, can "decide" how
much height it needs to accommodate its content. The vertical measurement
of the Detail section is controlled by the Height property. There
are two main ways you can change the Detail section's height at design
time:
- In the Format tab of the Properties window, you can change the
value of the Height field. The value must be a natural or a
decimal number. In reality it is a decimal number. If you type a
natural number, also called an integer, it would be converted to
decimal. If you type an invalid number, you would receive an error
- You can position your mouse in the lower border of the Detail
section until the mouse cursor changes into a vertical double arrow.
Then click and drag. You can drag up to shrink the section or drag
down to heighten it
The Form Header and the Form Footer
|
|
Besides the Detail section, a form can be equipped
with a section on top and another section in its bottom part. To add these
sections, you can right-click the middle of the form and click
Form
Header/Footer

This would add two new sections to the form: the Form
Header section on top and the Form Footer section at the bottom:
Although two sections are added, you can reduce one
completely so it would not appear to the user. This means that you can
keep one section and hide the other. If you create a form using the Form
Wizard, both the header and the footer sections are added but the footer
section is completely reduced so it would not appear to the user. If you
want to display it to the user, you must expand it.
Practical
Learning: Creating the Sections of a Form
|
|
- While the form is still displaying in Design View, right-click the
form and click the Form Header/Footer
- Save the form
The Page Header and the Page Footer
|
|
A form can also be equipped with two other sections.
To get them, you can right-click the middle of the form and click Page
Header/Footer.
This would add two new sections to the form: a Page
Header and a Form Header sections. These sections would not
appear to the user. They appear only if the user decides to print a form,
in which case they would appear on the printed paper. Like the form
sections, you can use either one or both the Page Header and the
Page Footer sections
A form is equipped with special horizontal lines used
to visually separate sections of a form. They do not perform any other
special action. To equip a form with dividing lines, add a header and a
footer sections. If you create a form that is directly equipped with a
header and a footer sections, it would display the dividing lines.
The presence or absence of the horizontal lines is
controlled by the Boolean Dividing Lines property. If you set its
value to Yes, the dividing horizontal lines would display on the
form. To hide both lines, you can set this properties value to No.
To hide an individual line, you can completely reduce its section.
Practical
Learning: Using Dividing Lines
|
|
- On the form, double-click the button at the intersection of the
rulers.
In the Properties window, click the Format tab and set the
Dividing Lines field to Yes
- Save the form
No comments:
Post a Comment