Database Management Systems: An Overview

advertisement
DB Implementation:
MS Access Forms
S511 Session 7, IU-SLIS
1
Outline

Access Forms
►
►
►
►
Views
Controls
Control Properties
Subforms
MS Access File for Lecture
S511 Session 7, IU-SLIS
2
MS Access Forms

Purpose
►
Data entry, editing, & viewing data in tables
• Forms are user-friendlier to end-users than tables.

“Window through which people see and reach the database”
• Forms have facilities for data filtering, automation, & validation that complement
table and query functionalities.




Display a subset of fields/rows for restricted access & facilitated data use
Add buttons that automate frequently performed actions
Create mechanisms (e.g., macros) that validate & facilitate data entry
Type
►
Bound form
• Bound to an underlying table or query
• Derives data from and writes to the underlying table
►
Unbound form
• Not linked (e.g. SwitchBoard)
S511 Session 7, IU-SLIS
3
Access Forms: Views

Form View
►
►

For entering & viewing data
Default view for the users
Layout View
►
For make changes to the form design while viewing data
•
•
►

The most intuitive view to use for form modification
Useful for setting the size of controls and assessing the visual appearance and usability of the form
Can be used for most of the form design changes
Design View
►
For performing advanced form design tasks
•
•
•
•
►
Add a wider variety of controls
Edit Text Box control source in the Text Box (instead of in the Property Sheet)
Change certain form properties (e.g., Default View)
Resize form sections (e.g., Form Header, Detail section)
Provides a more detailed view of form structure
•
•
e.g., Form sections
Cannot see the underlying data
S511 Session 7, IU-SLIS
4
Access Forms: Controls

Form Controls
►

GUI object that displays data, perform action, enhance UI.
Control Types
►
Bound control
• Source data = a field in a table or query
 For displaying values that come from fields in the database
►
Unbound control
• Does not have source data
 For displaying information, graphics (e.g., label, line, title),
 To perform actions, and
 To process user input
►
Calculated control
• Source data = an expression
• To display information calculated from underlying table/query or other controls
S511 Session 7, IU-SLIS
5
Form Controls: Basic

Text Box
►
►
Standard control for viewing & editing data
Holds the content of an existing table/query field or user input
MS Access 2007: Text Box

Check Box, Option & Toggle Button
►
Display On/Off, True/False, Yes/No values
•
►
Check Box = default control for Yes/No field
Typically used in an option group
 to represent one value of choice.
MS Access 2007: Check Box, Option & Toggle Button

Option Group
►
►

Groups controls together in a frame
 to allow only one selection in the group.
The value of an option group can only be a number, not text.
Command Button
►
Execute an action or a set of actions
MS Access 2007: Command Button
S511 Session 7, IU-SLIS
6
Form Controls: List & Combo Box

Display a list of choices to select from.

Can connect to existing data or use a fixed set of values
►
List Box
• Several rows are visible at all times.
• User is limited to the choices given.
 i.e., cannot type in new values
►
Combo Box
• List is hidden until the drop-down arrow is clicked.
• User can enter values not in the list.
 Text box + List box
MS Access 2007: List Box & Combo Box
S511 Session 7, IU-SLIS
7
Access Forms: Control Properties

Format Properties
►
►
►
►
►
►

Data Properties
►
►
►
►

Record Source  determine whether form/subform is bound or unbound
Control Source  determine whether a control is bound, unbound, or calculated
Default Value, Input Mask, Validation Rule/Text  same as Table Field properties
Locked  Yes to prevent data edit
Event Properties
►

Caption  set the value of Label controls
Visible  show/hide a control
Scroll Bars  show/hide vertical/horizontal scroll bars of form/subform
Record Selectors  show/hide the record selector of form/subform
Navigation Buttons  show/hide the navigation buttons of form/subform
Format  set the display format of Text Box controls
Set actions to perform by various event triggers
Other Properties
►
►
►
Name  set the name of a control
Pop Up  Yes to open a form as a pop-up window (disables menus & toolbars).
Modal  Yes to open a form as a modal window (disables navigation pane & other windows).
S511 Session 7, IU-SLIS
8
Form Properties: Combo/List Box

Format Properties
►
►
►
►
►

Column Count
• number of columns in the list
Column Widths
• width of each column separated by semi-colon
Column Heads
• Yes to display the column headings
List Rows
• max. number of rows to display
List Width
• width of the list
Data Properties
►
►
►
►
Row Source
• source of the list data
Row Source Type
• Table/Query, Value List
Bound Column
• the column whose value will be returned/used
Limit To List
• Yes to allow the user to enter a value not in the list
S511 Session 7, IU-SLIS
9
Form How-To: Creation

Create a form using the Form Tool
►
►
1.
2.
Place all the fields from the underlying data source on the form with a single mouse-click.
Begin using the form immediately or modify it in Layout/Design view.
In the Navigation Pane, click the data source for the form (i.e., table/query).
On the Create tab, in the Forms group, click Form.
•
•

Create a form using the Form Wizard
►
Place selected fields from the underlying data source on the form in a controlled fashion.
1.
On the Create tab, in the Forms group, click More Forms, and then click Form Wizard.
Follow the directions on the pages of the Form Wizard.
2.

Create a split form by using the Split Form Tool
►

Display a Form view and a Datasheet view at the same time.
•
use the datasheet portion to quickly locate a record, and then use the form portion to view/edit the record.
Create a form using the Multiple Items Tool
►

The form is created with the stacked control layout by default.
Click Remove in Control Layout group of the Arrange tab to undo the control layout.
Create a customizable form that displays multiple records.
Create a form using the Blank Form Tool
►
Create a form from scratch by selecting fields from the Field List.
S511 Session 7, IU-SLIS
10
Form How-To: Subforms

Subform = a form that is inserted in another form (i.e. main form)
►
good for showing data from 1:M relationship tables
•
Display customer data along with customer order information
►

Subform Creation
►
Creates a form and a subform at the same time
• By using the Form Wizard
1.
2.
►
select multiple linked tables/queries in Form Wizard
choose Form with subforms option in Form Wizard
–
main form = 1-side table, subform = many-side table
Add a form to another form to create a subform
• By dragging the subform/table to the main form
1.
2.
3.
open the main form in design view
make sure the Control Wizard Tool in the toolbox is selected.
drag a subform/table from the Navigation Pane onto the main form.
• By using the Subform/Subreport Tool
1.
2.
3.
4.
5.
open the main form in design view
make sure the Control Wizard Tool in the toolbox is selected.
click the Subform/Subreport Tool in the toolbox.
on the form, click where you want to place the subform.
select the linked table in Subform Wizard
MS Access 2007: Form with a subform
S511 Session 7, IU-SLIS
11
Form How-To: Tools
Layout/Design View
Design View
S511 Session 7, IU-SLIS
12
Access Forms: Design Considerations

Usability
►
Easy-to-understand
• Visual guide to the sequence of data entry
• Appropriate labels, formats, control tip text
►
Easy-to-use
• Facilitate data entry

►
Option Group, Check Box, Combo Box, Default Value
Logical layout
• Grouping, Tab Order
• Consistent look

Data Accuracy
►
Error-trapping features
• Input Masks, Validation Rules
►
Error-reduction features
• List box, Check box
S511 Session 7, IU-SLIS
13
Download