S511 Session 7, IU-SLIS 1 DB Implementation: MS Access Forms.

13
S511 Session 7, IU-SLIS S511 Session 7, IU-SLIS 1 DB Implementation: DB Implementation: MS Access Forms MS Access Forms

Transcript of S511 Session 7, IU-SLIS 1 DB Implementation: MS Access Forms.

S511 Session 7, IU-SLISS511 Session 7, IU-SLIS 11

DB Implementation:DB Implementation:MS Access FormsMS Access Forms

S511 Session 7, IU-SLISS511 Session 7, IU-SLIS 22

OutlineOutline Access Forms

► Views► Controls► Control Properties► Subforms

MS Access File for Lecture

S511 Session 7, IU-SLISS511 Session 7, IU-SLIS 33

MS Access FormsMS 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-SLISS511 Session 7, IU-SLIS 44

Access Forms: Access Forms: ViewsViews

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-SLISS511 Session 7, IU-SLIS 55

Access Forms: Access Forms: ControlsControls 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-SLISS511 Session 7, IU-SLIS 66

Form Controls: Form Controls: BasicBasic Text Box

► Standard control for viewing & editing data► Holds the content of an existing 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

to represent one value of choice.

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 2007: Command Button

S511 Session 7, IU-SLISS511 Session 7, IU-SLIS 77

Form Controls: Form Controls: List & Combo BoxList & 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-SLISS511 Session 7, IU-SLIS 88

Access Forms: Access Forms: Control PropertiesControl Properties Format 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

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► 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-SLISS511 Session 7, IU-SLIS 99

Form Properties: Form Properties: Combo/List BoxCombo/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-SLISS511 Session 7, IU-SLIS 1010

Form How-ToForm How-To: : CreationCreation Create a form using the Form Tool

► 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.

1. In the Navigation Pane, click the data source for the form (i.e., table/query). 2. On the Create tab, in the Forms group, click Form.

• 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 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. 2. Follow the directions on the pages of the Form Wizard.

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► 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-SLISS511 Session 7, IU-SLIS 1111

Form How-To: Form How-To: SubformsSubforms 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 Wizard1. select multiple linked tables/queries in Form Wizard2. 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 form1. open the main form in design view2. make sure the Control Wizard Tool in the toolbox is selected.3. drag a subform/table from the Navigation Pane onto the main form.

• By using the Subform/Subreport Tool1. open the main form in design view2. make sure the Control Wizard Tool in the toolbox is selected.3. click the Subform/Subreport Tool in the toolbox.4. on the form, click where you want to place the subform.5. select the linked table in Subform Wizard

MS Access 2007: Form with a subform

S511 Session 7, IU-SLISS511 Session 7, IU-SLIS 1212

Form How-ToForm How-To: : ToolsTools

Layout/Design View

Design View

S511 Session 7, IU-SLISS511 Session 7, IU-SLIS 1313

Access FormsAccess Forms: : Design ConsiderationsDesign 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