Access 2010: Form Design - Information Technology Services

advertisement
Access Form Design
Application Support and Training
Office of Information Technology, West Virginia University
OIT Help Desk (304) 293-4444, oithelp@mail.wvu.edu
Workshop Materials: oit.wvu.edu/training/classmat/db/
OIT Technical Support Services
Copyright 2008 West Virginia University
Table of Contents
Table of Contents................................................................................................ ii
Form Basics ........................................................................................................ 1
Uses of Forms ................................................................................................. 1
Types of Forms................................................................................................ 1
About Form Objects......................................................................................... 3
Creating Simple Forms ....................................................................................... 4
Four Basic Steps to Forms Creation................................................................ 4
Using the Simple Form Tool ............................................................................ 4
Working with the Layout View of a Form ......................................................... 5
Form Layout Tools ........................................................................................................... 5
Editing the Layout View ....................................................................................................7
Simple Editing in Layout View ......................................................................... 8
Other Arrangements ......................................................................................................... 9
Using the Property Sheet to Change Form Properties .................................... 9
Using the Property Sheet ............................................................................................... 10
Using the Form Wizard to Create a Form ....................................................... 12
Hands-on with the Form Wizard .................................................................... 12
Editing the Faculty/Classes Form .................................................................. 14
Using the Form Design Tool ............................................................................ 16
Form Design Tools .......................................................... Error! Bookmark not defined.
Designing a Form: Building the Main Form .................................................. 16
Designing a Form: Creating the Subform ..................................................... 18
Designing a Form: Integrating Subform and Main Form ............................... 19
Designing a Form: Improving the Appearance ............................................. 21
Glossary ............................................................................................................ 23
ii
Form Basics
Uses of Forms
A form is a database object that you can use to enter, edit or display data from a table
or query. They have a wider variety of functions and uses. With Access forms you can:
Enter data into the database
Using a form for data entry not only saves time, it is a way to prevent errors.
Values can be selected from pull down lists, thereby reducing typing time and
insuring that data entry rules are consistent.
View or browse data in the database
You can use a form to view or browse through the data from a single record in
form view or multiple records in tabular or datasheet view.
Replicate source documents
You can create an Access form that looks exactly like the paper source
document or data collection form. During data entry, the user doesn't have to be
concerned with finding the exact spot in the table to insert the data; the form and
its table links will position it in the correct table field.
Provide an attractive presentation of data
You can enhance the appearance of forms by using a variety of fonts, colors, and
special effects.
Display data from more than one table
The form can be based on a multiple table query instead of a single table. By
using this feature a single form can access the data from several tables at once.
Calculate values
You can incorporate aggregate functions (e.g., averages, counts, sums and
totals) into a form.
Hold a chart or pivot table
A form can display data in a graphical format (such as a bar chart or a pie chart)
or in a Microsoft Excel pivot table format. Note that these forms can only display
data; they cannot be used for data entry.
Types of Forms
Just as forms can have different uses, there various types of forms and tools with which
to create them. Following is a brief description of the form creation tools as they appear
in Access 2010
You can find Forms tools on the Forms group of the Create tab:
Access 2007 Form Design
1
These tools are listed in their order of appearance on the tab.
Note that new terminology is being introduced here. However, because of the way that
this section is organized, you may have to read about a subsequent form type in order
to understand all of the references.
1. (Simple) Form Tool
When you use this tool, all of the fields from the underlying data source are
placed on the form. You can begin using the new form immediately, or you can
modify it in Layout view or Design view to better suit your needs. If Access finds
a single table that has a one-to-many relationship with the table or query that you
used to create the form, Access adds a datasheet to the form that is based on
the related table or query.
2. Form Design
You can create a new blank form in Design view. On the design grid, you can
make advanced design changes to forms, such as adding custom control types
and code. The property sheet gives you access to a large number of properties
that you can set to customize your form.
3. Blank Form
If one of the form-building tools doesn’t fit your needs, you can use the Blank
Form tool to build a form. This can be a very quick way to build a form, especially
if you plan to put only a few fields on your form.
4. Form Wizard
If you want to be more selective about what fields appear on your form, you can
use the Form Wizard instead of the various form-building tools previously
mentioned. You can also define how the data is grouped and sorted, and you can
use fields from more than one table or query, provided that you specified the
relationships between the tables and queries beforehand.
5. Navigation
The Navigation form allows you to easily create web-based database
applications by creating form navigation tabs (horizontal, vertical, left, or right).
Child forms load when you click on them, as opposed to the traditional tab
control, which loads all of its child objects as it loads.
6. More Forms
When you click on the selection arrow to the right of the More Forms icon you will
get a dropdown menu, which lets you select a Form Wizard,
Datasheet, Model Dialog, and PivotTable.
a) Multiple Items
When you create a form by using the Simple Form tool, the
form that Access creates displays a single record at a time.
If you want a form that displays multiple records but is more
customizable than a datasheet, you can use the Multiple
Items tool. Access creates the form and displays it in
Layout view. In Layout view, you can make design changes
to the form while it is displaying data. For example, you can
adjust the size of the text boxes to fit the data.
2
Access 2007 Form Design
b) Datasheet
A datasheet form will display multiple records in a typical datasheet view or
single records in a tabular view. This form is used mainly as a subform,
which shows the “many” side of a one-to-many relationship.
c) Split Form
The split form gives you two views of the data at the same time – a form view
and a Datasheet view. The two views are connected to the same data source
and are synchronized with each other at all times. This gives you the
bene3fits of both types of forms in a single form. Selecting a field in one part
of the form selects the same field in the other part of the form. You can add,
edit, or delete data from either part.
d) Modal Dialog
A Modal Dialog is a special form, which allows you to collect some input from
the user or convey some important information to the user before Access can
proceed. You must be familiar with Form Design in order to create a Modal
Form.
e) Pivot Chart
A PivotChart is a graphical representation of the values in a PivotTable.
Capabilities include the ability to move the fields from one area of the chart to
another, hiding items, filtering data, and more.
f) PivotTable
This form tool allows you to summarize hundreds of records in a concise
tabular format, which allows you to manipulate the layout – or pivot – of the
table to see different views of your data. See also PivotChart.
About Form Objects
All of the information on a form is contained in controls. Controls are objects on a form
that are used to display data, perform actions, or decorate the form.
Some controls are bound (linked) to fields in a table or a query. These controls can
place data into the fields or display data from the fields.
Unbound controls do not have a source of data. These are typically used to display
labels or instructions.
Different types of controls or objects are used to display different data types: a text box
is used to display data and numbers, an object box is used to display pictures, and
other controls display information that is part of the form design.
Labels are controls that are used to display descriptive text, while lines and squares are
controls that are used to organize or separate data.
The image control is used to enhance the appearance of the form with a logo, clip art,
or some other graphic file. If you want each database record to have a different image
(e.g. employee photographs), then use a bound object control instead.
Calculated controls act like bound controls but are used to display the results of a
calculation. Frequently the parameters used in the underlying formula are other controls
on the form.
Access 2007 Form Design
3
Creating Simple Forms
The creation forms in Access 2007 can be simple and straightforward when you use
one of the wizard tools that are provided in the Forms group of the Create tab. Time will
not allow us to learn about and work with all of the possible Forms tools that are at our
disposal.
Note that most of the Forms tools will create a form based either upon an open table or
query, or it is based upon one that is currently highlighted in your Navigation Pane.
Four Basic Steps to Forms Creation
Following is a general procedure for creating a form:
1. Select the appropriate table or query in the Navigation Pane.
2. Click on the Create tab in the ribbon in the menu section near the top of the
Access window.
3. Locate the Forms group within the Create tab.
4. Click one of the icons or pull-downs to select the Form tool you wish to use.
Using the Simple Form Tool
Create a form to add or update information in the Classes table using the standard
Form tool. Open the sample database Faculty if it is not already open.
1. In the Navigation Pane along the left, highlight and select the SimplyClasses
query (Remember, you can also create a form based upon a query).
2. Click on the Create tab.
3. In the Forms section of the Create tab, click on the Form icon.
4
Access 2007 Form Design
Your resulting form will look like the
image to the right (minus the cropped-out
middle):
The form is a friendlier version of the data
table – you can make changes to fields
by re-typing the information, or you could
use the familiar record navigation tool at
the bottom of the form to navigate, search
for information, or add a new record.
Although this is considered a “simple
form,” there are a lot of potential ways in
which you can customize it.
The next section will explore some of the
customization features that are available
in the layout view of a form.
Working with the Layout
View of a Form
The simple form that we created in the previous section starts out in Layout view,
meaning that you can make design changes to the form while it is displaying data. The
Layout view provides you with a graphical and intuitive view to form modification. It can
be used for nearly all of the changes you would want to make to a form in Access 2007.
Using the actual form data as your guide, you can rearrange controls and adjust their
sizes.
Before we dive in and start making changes, however, let’s take a moment to look at the
two new tabs, which appear in conjunction with the Form Layout Tools: Design,
Arrange, and Format.
Form Layout Tools
Some ribbon tabs in Access 2010 are only visible when they can be used. The Format
tab and the Arrange tab are shown when you have created, or are working with, a form.
Design Tab
The Design tab contains command groups that are related to form design functions.
·
Views – When you create a form, the Views group of the Home tab will display the
three possible views of the tabbed document: Form, Layout, or Design. The Form
View is the standard form interface, while the Layout View and Design View are
used for modifying the form’s appearance.
o Form View is the standard production form, where you enter, change, or view
data using the form itself.
Access 2007 Form Design
5
o Layout View provides you with an intuitive view in which you can modify a
form’s design and layout. The form is actually running, so you can see your
data much as it will appear in Form view.
o Design View gives you a more detailed view of the structure of your form. It
is here that you’ll see the Header, Detail, and Footer sections of the form.
The form is not actually running when it is in Design view, so you cannot see
the underlying data while you are making changes.
·
·
·
·
Themes – work with pre-designed themes, color schemes or fonts.
Controls – add form controls. Place your mouse pointer over a tool to display its
name.
Header/Footer – add logos, titles, page numbers, or the date and time to a form
Tools – add existing fields or view the Properties Sheet. From the Property Sheet
tool you can precisely define all of the characteristics and behaviors of any selected
component.
Arrange Tab
The Arrange tab is shown below with some of the major components explained:
·
Table –
·
Rows & Columns
·
Merge/Split –
·
More –
·
Position – Deals with the positioning aspects of a control.
Format Tab
The Format tab is shown below:
6
·
Selection – select controls or labels by name.
·
Font – font-related effects, such as bold, italics, font color, text alignment, and
color fills.
·
Number – formatting effects for numeric fields, including currency, percentage,
comma format for numbers, or how many decimal places numbers are displayed
with.
·
Background – add gridlines and line styles to your layout.
·
Control Formatting – lets you apply conditional formatting, or change the shape,
shape fill and shape outline or a control.
Access 2007 Form Design
Note that some formatting operations will work on individually selected controls, while
other operations will affect the overall layout.
Editing the Layout View
As you may surmise from the Format tab above, there are many possible features that
one can apply in the Layout view. We will only touch on a few of them here.
Selection Techniques
Following are some useful selection techniques:
·
Click to select – When your form is in Layout view, you can individually highlight
and select each of the form controls (i.e., the form logo, the “Classes” title, each
field label, and each field data box).
·
Select multiple individual controls – If you want to select multiple controls
(labels or data fields), you can hold down the Shift key as you left-click the
mouse button. This technique allows you to make multiple selections.
·
Select all of the controls in the stacked layout – In stacked layouts, where the
controls are arranged vertically with a label to the left of each control, a move
handle is displayed in the upper-left of the layout. Click the move handle to
select the entire layout.
·
Select an entire row or column – In stacked layouts, you can select an entire
row or column by right-clicking your mouse and selecting Layout from the
shortcut menu. From Layout, you can Select Entire Row or Select Entire
Column.
Access 2007 Form Design
7
Simple Editing in Layout View
Now that you’ve had a brief introduction to some of the tools and techniques of form
layout, let’s look again at the simple Classes form:
Note that the data fields in this form are much longer than is necessary to display the
data. We can use a simple mouse selection and dragging technique to resize those
fields.
1. If it is not already highlighted
as shown in the picture on the left,
select the first field, CourseNum.
2. Place the mouse pointer over
the far-right vertical edge of the data
field until the cursor changes into a
double-headed arrow.
3. With the double-headed arrow
over the control boundary, left-click
and drag it slowly to the left, stopping
at approximately one-third of the
original width.
Notice that when you resized the first
control, all of the other controls
beneath it were also changed. This is
because the Control Layout is
stacked. If you want to resize each
control independently of the other,
you must issue a Remove Layout command (This command is fairly well hidden:
Right-click over a field à select layout from the shortcut menu à and Remove Layout
from the submenu).
Because of the stacked layout, a change to the dimension of one label or text box will
change the dimensions of all labels or text boxes. The same, however, does not apply
to other formatting, such as font and font sizes:
1. Select the CourseNum data table, which is at the top-left.
2. In the Font group of the Format tab, click on the boldface button, B, and observe
that only the CourseNum label is bolded.
3. Next, while holding down the Shift key click on each of the remaining data labels
in turn, until you’ve selected all of them.
4. In the Font group of the Format tab, click on the boldface button, B, and observe
that all of the selected labels now are bold.
You can edit or change the caption for a label by simply clicking upon it.
1. Click on the label CourseNum and expand it to “Course Number.”
2. Follow suit with the remaining labels:
SectionNum
8
à
Section Number
Access 2007 Form Design
CTitle
à
Course Title
CreditHours
à
Credit Hours
ClassDays
à
Class Days
ClassTime
à
Class Time
RoomNum
à
Room Number
3. Note that in expanding the label text, you may now have to re-adjust the left
border of the data field text box so that the full text is visible.
Other Arrangements
The Form Layout Tools contain many commands with which you can enhance your
form.
In the Position group of the Arrange tab, click on the Control Padding
command and experiment with various settings (i.e., None, Narrow, Medium, and
Wide).
You can edit or change the header details, such as the title, logo, or date/time
information.
1. Locate the Title icon in the Header/Footer group of the Design tab, and click on
it. Notice that Classes, the title at the top of the form, is now highlighted and
active.
2. Change the title to read Classes for this Semester.
3. Click elsewhere in the form to de-select the title.
4. Other related commands in the Controls group include Logo, which lets you add
graphics to your database, as well as Date and Time, which provides a running
header.
Using the Property Sheet to Change Form Properties
If you want complete control over the behavior and appearance of your controls, then
the one place to look is the Property Sheet, which is available in either Layout View or
Design View. Controls and other sections of a form have properties that determine their
appearance, behavior and structure.
Two ways to see the Property Sheet are:
1. Select a specific control (or group of controls) and right-click your
mouse. In the shortcut menu, select Properties.
2. On the Design tab, click the Property Sheet command, which appears
in the Tools group.
Property Sheets contain a lot of information (more than 100 properties). Illustrated
below is portion of the Property Sheet for the CourseNum control from the Classes form
Access 2007 Form Design
9
we’ve been working on:
Following is an explanation of the four main components:
1. Selection type
On an open Property Sheet, you can choose the object name from the dropdown
box. The properties are specific to an object type, so if you click on another
portion of the form, such as the header or a detail section, you will see different
selection choices.
2. Tabs
Access provides tabs at the top of the property sheet so you can choose to
display only specific properties, such as format properties
3. Property types
Don’t be daunted by the large number of property types. When designing most
forms, you’ll find that the Format tab contains most of the property types you’ll
use, and among those the ones at the top of the list are the most commonly
used.
4. Property box
To the right of each property type is a property box. Some property boxes, such
as Width and Height, allow you to type in the value. However, when you click in
a property box that provides a list of values, a down-arrow button appears on
the right side of the property box. Click this button to see a dropdown list of the
values. In some cases, a builder is available to help you create property
settings for complex properties. When such a builder is available, Access
displays a small button with an ellipsis (…) next to the property box.
Using the Property Sheet
Let’s look at some of the formatting that we can apply by using the Property Sheet. If
you do not already have the Property Sheet panel displayed for your Classes form, use
one of the two methods outlined above in Using the Property Sheet to Change Form
Properties.
10
Access 2007 Form Design
Select the entire column of data fields: right-click your mouse over one of the data
fields, and choose Select Entire Column. Note that the Selection type component of
the Property Sheet is now set to Multiple selection.
1. Look for the Width property in the Format tab of the property sheet. In the
property box to the right of Width, replace the value there with the numeral 2 and
press Enter. You’ve just made the width of every data field exactly two inches.
2. Take note of the Height property. Is it blank? Try changing it to 0.2.
3. With the entire right column still selected, locate the Back Color property. Click
in the property box to the right and observe that both a down-arrow button and a
builder appear. Click on the down-arrow and select Access Theme 9. The data
fields are now a solid blue, leaving the font color almost illegible.
4. Locate the Fore Color property, and select Access Theme 1. The contrast
between background color and font (fore) color is much more readable.
5. Now, set the Font Size property to 14. Notice, however, that the Height property
has also changed. Set the Font Size property back to 11, and note that the
Height property did not decrease when the font size went down!
This has been a small example of ways that you can manipulate format properties.
Access 2007 Form Design
11
Using the Form Wizard to Create a Form
The simple form tools create a form with all of the available data fields, from which you
can then pare down and arrange data fields in layout view. Another form tool, called the
Form Wizard, let’s you take a different approach: you start with precisely what you want
and work from there.
For this example, we’ll use something a little more complicated: the Faculty table,
which has a relational link to the Classes table (i.e., Faculty ID in the Faculty table has a
one-to-many relationship with Instructor in the Classes table). So that you can better
understand where we’re going, let’s briefly revisit the simple form as it would look with
the Faculty table:
1. Highlight/select the Faculty table in the Navigation pane.
2. Go to the Create tab and click on the Form command in the Forms group.
The result, which has too much information to easily show in an illustration, is a stacked
two-column form for the Faculty data, followed by a tabular layout for the Classes data.
The new form that we will create will only contain a few fields from Faculty table:
·
Last Name
·
First Name
·
Department
The rest of the form will emphasize the Classes table.
Hands-on with the Form Wizard
1. Go to the Create tab, and in the Forms group, click on the Form Wizard icon. A
Form Wizard dialog appears:
12
Access 2007 Form Design
2. In the first Form Wizard panel, you can select the Tables/Queries that you will
use. By clicking on the selection arrow to the right of the Tables/Queries box,
select Table: Faculty.
3. The next step involves the selection of fields from the list of Available Fields on
the left side and placing them In the Selected Fields box on the right side by
clicking the single selection button.
The data fields – in the order we want
– are Last Name, First Name, and Department.
4. Return to the Tables/Queries selection arrow, and change the selection to
Table: Classes.
5. Click on the select all button
Selected Fields box.
to add all of the Available Fields to the
6. At the bottom of the Selected Fields box, select and remove the last three fields,
Instructor, Building, and RoomNum, by selecting them and clicking the
deselect
button.
7. Find and remove the field Classes.Department, which is redundant; it contains
the same information as the Department field from Faculty.
8. Click the Next> button on the Form Wizard to continue.
9. The next panel of the Form Wizard dialog asks how you want to view your data.
The wizard knows that your form data is coming from two different tables, so it’s
offering you the choice to group by Faculty or by Classes.
a. Keep the default choice, by Faculty
b. Make sure that the default, Form with subform(s) is also selected
10. Click the Next> button on the Form Wizard to continue.
11. The next panel of the Form Wizard dialog asks how what layout (Tabular or
Datasheet) you would like for your subform. Keep the default choice,
Datasheet.
Access 2007 Form Design
13
12. Click the Next> button on the Form Wizard to continue.
13. The final Form Wizard panel asks you to enter titles for your form and subform.
These will also be used as names in the Navigation pane. Choose something
descriptive, like “Faculty/Classes” for the form name. The default, “Classes
Subform,” is an acceptable subform title.
a. The wizard also asks whether you want to open the completed form or
modify it in Design view. We’re done for now, so stay with the default,
which is to open the form to view or enter information.
14. Click on the Finish button.
The completed form should appear similar to this:
Editing the Faculty/Classes Form
One of the first things you might notice is that you could do a better job (than Office) of
formatting the Classes subform – header labels are cropped, and there are fields hidden
beyond the horizontal scroll bar. Just as with the simple form, you can edit your wizardcreated form by working with it in Layout view.
1. In the Views group of the Home tab, click on the Layout View command.
2. We can save considerable space by tightening up the “Classes” label. Click on
the label to select it. Instead of manually sizing it, click on the Property Sheet
command, which is in the Tools group of the Arrange tab.
3. On the Format tab of the Property Sheet, verify that the Classes label is selected:
the property box for Caption should read “Classes.”
4. Look for the property box for Width, which is a couple of lines down. By
overtyping, change the Width value to .5 (that’s point-five inches). Leave the
field by hitting Enter or the tab key and notice that the label for Classes is
considerably narrower. If it looks like the data for Classes has disappeared, click
14
Access 2007 Form Design
the forward arrow on the record selector, which also acts to refresh that part of
the layout view.
5. Even after narrowing the Classes label, part of that subform remains hidden from
view, as is evidenced by the horizontal scroll bar. You can highlight and select
the right side of the border around the subform, and drag it out to where you can
see the entire ClassTime field. When you do, the horizontal scroll bar will
disappear.
6. Some of the field headers of the subform are not fully visible, either, but it
becomes a judgment call as to whether you want to expand them fully or perhaps
give them a shorter name. Unfortunately, you cannot change the names in
Layout view. For that, you must use Design view.
Access 2007 Form Design
15
Using the Form Design Tool
Designing a Form: Building the Main Form
You can invoke the Form Design tool to edit an existing form, or you can use it to build a
form entirely from scratch. Using our last form (see the Form Wizard) as a model, let’s
see how we would build it from scratch, using the Form Design tool.
1. In the Forms group of the Create tab, click on the Form Design command. This
will display a blank form design grid in a new tab.
Note the rulers along the top and left side. A Detail section starts immediately
below the top ruler. If you right-click the mouse over this design grid, you’ll see a
menu from which you can add form sections such as headers/footers or display a
number of other options. To resize the design grid, you can use the mouse to
position the cursor over the right or bottom border and use click & drag.
2. If the Field List is not visible along the right size of the design grid, go to the
Tools group of the Design tab, and click on the Add Existing Fields command.
A Field list panel will display on right side of your window.
3. Click the plus sign to the left of Faculty to display the data fields in the faculty
table.
4. One by one, select and drag these fields from the Field List and drop them
toward the left side of your blank form (don’t fuss with exact placement – we’ll fix
that soon):
a. FacultyID
b. Last Name
c. First Name
d. Department
5. Select all four of these controls by lassoing them: left-click your mouse in one
corner and drag it diagonally to include the four controls so that they are all
16
Access 2007 Form Design
selected:
6. With the four controls selected, go to the Arrange tab, and in the Table group
click the Stacked command. This will group and arrange the four controls (shown
on the left).
7. In order to reposition these so that they have more space between them, we
must first remove that layout applied to them. Go to the Arrange tab, and in the
Table group click the Remove Layout command.
8. With the Stacked layout removed, click on the Control Padding command,
which is in the Position group. Select the Medium padding.
9. Use the left or right arrow keys on the
keypad to move the entire group of
controls up until the left side of the
Faculty ID control is aligned with the halfinch mark on the horizontal ruler.
10. Click the mouse pointer on a blank
portion of the design grid in order to deselect the controls.
11. With the four controls de-selected, left-click the mouse pointer over one of the
data fields (NOT the labels) and choose Select Entire Column from the shortcut
menu.
12. With the four data fields
selected, move the cursor
over to the right side of the
data fields until you can
see the double-headed
resize arrow. Drag the
right side of the controls
until they are aligned with
the four-inch mark on the
horizontal ruler.
13. The Faculty ID field is necessary because it is part of the relationship between
the Faculty table and the Classes table. However, it is not necessary that it be
seen on the form.
Access 2007 Form Design
17
a. Deselect the controls again by clicking the mouse pointer on a blank
portion of the design grid.
b. Click on the data field for just the Faculty ID to select it.
c. Display the Property Sheet. (The command is in the Design tab, Tools
group)
d. On the Format tab of the Property Sheet, click to the right of the property
box for Visible (the 3rd property type down) and change the setting to No.
14. Click the Save icon and save the form as Designing Form.
Here is what the final result should look like in Design view:
And here is what the final result should look like in Form view:
Designing a Form: Creating the Sub-form
Recall that the Faculty/Classes form we are trying to duplicate had a Classes sub-form.
When working strictly in Design view, the sub-form is started in the same way as a
“regular” form.
1. In the Forms group of the Create tab, click on the Form Design command. This
will display a new blank form design grid.
2. If the Field List is not visible, go to the Tools group of the Design tab, and click on
the Add Existing Fields command. A Field list panel will display on right side of
your window.
3. Click the plus sign to the left of Classes to display the data fields in the classes
table.
4. One by one, double-click on each of these fields from the Field List:
a. CourseNum
b. SectionNum
c. CTitle
d. CreditHours
18
Access 2007 Form Design
e. ClassDays
f. ClassTime
g. Instructor
5. Display the Properties Sheet (The command is in the Design tab, Tools group)
6. In Selection type: (at the top of the Properties Sheet) click the selection arrow
and select Form.
7. On the Format tab of the Property Sheet, click to the right of the property box for
Default View and select Datasheet. If there are multiple records, this will cause
each of them to be displayed together on the sub-form. Note that because we
are formatting our sub-form as a datasheet, there’s little need in positioning the
controls.
8. We don’t need to actually see the Instructor control:
a. In Selection type: (at the top of the Properties Sheet) click the selection
arrow and select Instructor.
b. On the Format tab of the Property Sheet, click to the right of the property
box for Visible (the 3rd property type down) and change the setting to No.
9. Finally, let’s add more meaningful labels to our data fields. Click on the label
control for CourseNum. On the Format tab of the Property Sheet, click in the
Caption property box and type “CRN” (short for Course Reference Number). In
likewise fashion, add label captions for
a. SectionNum à Section
b. CTitle à Title
c. CreditHours à Credit Hours
d. ClassDays à Days
e. ClassTime à Time
10. Click the Save icon and, when prompted, name this form Designing Class
Subform. Switch from Design View to Datasheet View and see what our subform will look like.
11. We will be incorporating Designing Class Subform as a sub-form in the next
section, so you need to close the Designing Class Subform before continuing.
Designing a Form: Integrating Subform and Main Form
With the completion of the sub-form, we are now ready to assemble the two forms.
1. Go back to Designing Form in Design view.
2. Click on the Design tab, and in the Controls group be sure
that the Use Control Wizards command is highlighted.
3. In the same group, click on the Subform/Subreport command. The mouse-over
screen tip will help you identify it.
4. Move your mouse pointer down into the design grid and notice that the cursor
has changed shape. Position the cross-hair beneath the Department label,
Access 2007 Form Design
19
where we will place the subform. Click the left mouse button. An unbound
control will appear beneath Department, and a SubForm Wizard will appear
beside it.
5. In the SubForm Wizard,
a. Be sure that the Use an existing form radio button is selected
b. Designing Class Subform is highlighted, and
c. Click the Next> button
6. In the second SubForm Wizard you are asked to define which data fields will be
used to link your main form to the subform. Now you will see the significance of
why we needed to include the respective Faculty ID and Instructor fields during
the form design phase:
20
Access 2007 Form Design
a. Be sure that the Define my own radio button is selected
b. In the first For/report fields selection list, choose Faculty ID
c. In the first Subform/subreport fields selection list, choose Instructor
d. Click the Next> button
7. In the third and final SubForm Wizard, you are asked to name the subform. This
name will become the control label for the subform. Type in Classes and then
click the Finish button.
After clicking Finish, you will see the completed Designing Form with the included
Designing Class Subform. This design layout is a little misleading – remember that we
had set the field property of the Default View to Datasheet.
In the Views group of the Design tab, switch to Form View in order to see the completed
form in action.
Designing a Form: Improving the Appearance
Our custom form is now essentially completed. All that remains is a little bit of cosmetic
work, a task for which the Layout View is quite well suited. Recall that Layout View
displays your actual data, but it allows you to perform a variety of simple layout tasks.
1. In the View group of the Home tab, select the Layout View.
2. Select the Classes sub-form and resize it,
a. Move the top margin down a bit so that the Classes label is more visible
b. Move the right margin further to the right so that all of the field labels are
visible and the horizontal scroll bar has disappeared from the subform
(you can close the Property Sheet in order to see more of the form).
c. Move up the bottom portion of the subform so that there’s enough room to
display five or six classes.
3. In the Header/Footer group of the Design tab, click the Title command.
Designing Form appears as a title header on the form, but you can change it to
something more meaningful if you like.
4. In the Themes group of the Design tab, select an attractive theme and apply it.
Access 2007 Form Design
21
By now, you should get the idea – you can use other formatting tools (i.e., Logo, Date
and Time, Fonts, Fill colors, etc.) in Layout View to improve the appearance of your
form.
The same location that you found the Faculty database for this training should also
contain an Images folder from which you can experiment with inserting images or logos.
Switch to Form View and admire your handiwork as an Access form designer.
22
Access 2007 Form Design
Glossary
Control
Controls are objects that display data, perform actions, and let you view and work
with information that enhances the user interface, such as labels and images.
Controls can be bound, unbound, and calculated.
bound
controls are connected or linked to a data field in a table or query.
unbound
controls do not have a source of data. They are used to display labels or
instructions.
calculated
controls display the results of a calculation. Frequently the parameters
used in the underlying formula are other controls on the form.
Detail Section
The detail section is used to display records of data. It will display one or more
records on a single screen or page.
Dialog box launcher
A left-facing diagonal arrow, which sometimes appears in the bottom corner of a
tab group to indicate that a full-featured dialog box is available to the user.
Form Header
The form header displays a title for the form along with control buttons and/or
instructions. In form view, the header appears at the top of the screen. When
printed, the header appears at the top of the first page. The header is not used in
datasheet view.
Form Footer
The form footer appears at the bottom of the screen in form view and at the end
of the printout when the form is printed. It is not used in the datasheet view.
Labels
Labels are controls that are used to display descriptive text, while lines and
squares are controls that are used to organize or separate data.
Page Footer
The page footer is only used on printed forms and it appears at the bottom of
each page. It is used to display data like the page number or date.
Page Header
The page header is only used on printed forms and appears at the top of each
page. It is used to display titles, column headers, and other information.
Stacked layout
In stacked layouts, controls are arranged vertically like you might see on a paper
form, with a label to the left of each control.
Tabular layout
Access 2007 Form Design
23
In tabular control layouts, controls are arranged in rows and columns like a
spreadsheet, with labels across the top.
24
Access 2007 Form Design
Download