DB Implementation:
MS Access Forms
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 enables the collection of accurate & complete data.
Guide users to enter data correctly
Include mechanisms that validate & facilitate data entry
• Layout for optimum data entry
• Check for missing/invalid/inconsistent data
Forms can also be used
To collect user input for querying the database
To display navigation menus
MS Access Forms: Type
Bound form
Bound to an underlying table or query
Derives data from and writes to the underlying table
Unbound form
Not linked to table or query
• e.g., SwitchBoard/navigation menu
• e.g., Search interface
Database Design Seminar
MS Access Forms: Views
Form View
For entering & viewing data
• Default view for the users
Layout View
For making changes to the
form design while viewing data
• Useful for setting the size of controls
• Supports limited design tasks
Design View
For performing
advanced form design tasks
• More detailed view of form structure with a wider variety of controls
MS 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 in table/query
Unbound control
• Does not have source data
→For displaying information, graphics &
→To process user input
Calculated control
• Sourcedata = an expression
• To display information calculated from underlying table/query or other controls
Database Design Seminar MS Access: Introduction to Controls
Form Controls: Basic
Text Box
Standard control for viewing & editing data
Holds the content of a table/query field (or user input)
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
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: Text Box
MS Access 2007: Check Box, Option & Toggle Button
MS Access: Command Button
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 in the drop-down window
• User can enter values not in the list.
→ Text box + List box
Database Design Seminar MS Access: Add a List Box or Combo Box
Access Forms: Control Properties
Format Properties
Caption
→ Set the value of Label controls Visible
→ Show/hide a control Scroll Bars
→ Show/hide form’s scroll bars Record Selectors
→ Show/hide form’s record selector Navigation Buttons
→ Show/hide form’s navigation buttons Format
→ Set the display format
(Text Box control)Access Forms: Control Properties
Data Properties
Record Source →
Specify whether form/subform is bound or unboundControl Source →
Specify whether a control is bound, unbound, or calculatedLocked →
Yes to prevent data editEnabled →
No to stop responding to user interaction Event Properties
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 (stays on top of other windows)
Modal →
Yes to open a form as a modal window (disables other windows).
Database Design Seminar
Form Properties: Combo/List Box
Format Properties
Column Count
→Number of columns in the list
Column Widths
→Column widths separated by semi-colon
Column Heads
→Yes to display the column headings
List Rows
→Max. number of rows to display
List Width
→Total 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
→No to allow the user to enter a value not in the list
Form How-To : Form Creation
Create a form using the Form Tool
→ Places all the fields from table/query on the form with a single mouse-click.
• 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.
1.
In the Navigation Pane, click the data source for the form
(i.e., table/query)2.
On the Create tab, click Form in the Forms group
Database Design Seminar
Form How-To : Form Creation
Create a form using the Form Wizard
→ Place selected fields from table/query on the form in a controlled fashion.
1.
On the Create tab, click Form Wizard in the Forms group
2.
Follow the directions on the pages of the Form Wizard.
Form How-To : Form Creation
Create a split form by using the Split Form Tool
→ Display a Form view & a Datasheet view at the same time.
1.
In the Navigation Pane, click the data source for the form
(i.e., table/query)2.
On the Create tab, click More Forms & then Form Wizard in the Forms group
Database Design Seminar
Form How-To : Form Creation
Create a split form by using the Multiple Items Tool
→ Create a customizable form that displays multiple records.
1.
In the Navigation Pane, click the data source for the form
(i.e., table/query)2.
On the Create tab, click More Forms & then Multiple Items in the Forms group
Form How-To : Form Creation
Create a form using the Form Design Tool
→
Create a form from scratch by selecting fields from the Field List.
1.
On the Create tab, click Form Design in the Forms group
2.
Select a table/query in the Record Source property
(Data tab of Property Sheet)3.
Click Add Existing Fields in the Tools group on the Design tab
4.
Drag form fields from Field List to the Form Design window
Database Design Seminar
Form How-To : Tools
Design Tab
1. Change Form Views (Form View, Layout View, Design View). 2. Place Form Controls on the form 3. Add existing fields to the form. 4. Set Control Properties. 5. Set the data entry sequence.
Arrange Tab
1. Apply/Remove Layouts (Stacked, Tabular). 2. Set Control size and spacing. 3. Align Controls. 4. Set Control order (front, back)
Format Tab → Format controls (font, color, fill, etc.)
Access Forms : Design Considerations
Usability
Easy-to-understand
→
Visual guide to
data entry sequence
→
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 Quality
Error-Trapping features
→
Input Masks
→
Validation Rules
Error-Reduction features
→
List box
→
Check box
Error-Checking queries
→
Null data check
→
Duplicate data check
→
Data inconsistency check
Database Design Seminar