Return to IFS 110 Notes!

Click for Printer Version

Tutorial 4
Designing Complex Forms  

Introduction to Forms

l      Distinction between bound and unbound forms

•    The form on page 140 (Figure 4-1) is an unbound form because it is not tied to any table or query.

•   This form is used as an interface to the other database objects.

•   The buttons on the form, when pressed, perform some action but do not work in conjunction with table data.
•   The unbound form example on page 140 is called a switchboard because its purpose is to open other database objects such as forms and reports.

•    On the other hand, the forms on page 152
Figures 4-11 and 4-1 are called bound forms.

•   The bound form is associated with an underlying table. When data is entered into the bound form, the data in the table is manipulated accordingly.

Unbound Form Example

Bound Form Example

Form Design

l      Forms are the user’s view of the database.

•     It is very common to provide an interface in which the user never actually sees the Access environment at all. (Unbound form)

•     important that the interface is attractively laid out, easy to navigate, and requires the least amount of “learning curve”. 

•    The more the interface looks like Windows-based application, the easier it will be for the user to learn.

l      User Interface - mechanism by which the user communicates and interacts with the application. From the user’s perspective, the user interface is the application.

l      ScreenTip - A message that appears when the pointer is positioned on a control on a form or on a button on a toolbar

l      Splash Screen - A form that opens automatically when a database is opened, and is designed to give the user something to view while the application is loading

Form Design guidelines goals

  1. Look and feel like Windows (Office)

Input text boxes – white background, sunken special effect

Output text boxes – flat effect same background color as form

  1.  Simple is better – avoid too many colors and fonts (group information)

  2. Be direct – linear, intuitive ways to accomplish tasks

Organize controls logically, keystroke shortcuts on command buttons and menus

  1. Provide feedback – ScreenTip messages

ScreenTip is a message that appears when pointer is over a control on a form or toolbar button
(short and informative)

Figure 4-3 Example of Controls in a Dialog Box

Form Template vs. Form Master

l      form template - establish default property setting, form size, and form sections (i.e., the basic structure for all forms in the database).

•     if form template not created, all new forms are based on the Normal form template.

•     works exactly the same way as a Word template

•     The form template does not have any controls in it.

l      form master -  specify controls common to all forms in the database.

•     New forms take on the characteristics of the Form Template but NOT the form master.

•     form master must be copied and pasted to new forms.  So all new forms will be based on the form template and then, where it is desired, the form master will be copied to the new form.

l      think through design of a database BEFORE beginning.

•     If wait until all the forms created, these techniques are immaterial because forms already completed 

•    want common elements to be applied to the existing forms, much more work will be involved then if had created the template and master ahead of time.

Creating Data Entry Forms

l     frmDegrees – college degrees data (created)

l     frmDepartments – company departments data (new)

l     frmEmployees – data on employees (created & modified)

l     frmJobs – used to review hours spent to date on existing jobs (created)

•    Contains a read-only subform (time card data)

l     frmJobTitles – job titles data (created)

l     frmTimeCards – data on labor and projects (incomplete)

•    Central form in database, used to enter data into tblTimeCards and tblHours tables

Identifier Operators

l     Identifier Operators - Operators that are used in expressions, macros, and VBA code to identify objects and their properties

•    Bang Operator (!) - An operator that is used to separate one object from another or from the object collection.

l     Collection - An object that contains a set of related objects

•    (Forms collection – all open forms in database)

l     Dot Operator - An operator that is used to separate an object from its property or method

l     Zero-Based - An object which begins its counting with the number 0.

Identifier Operators (example code)

l     Forms![Orders]![OrderDate].DefaultValue

•    This identifier refers to the value of the DefaultValue property of the OrderDate control on the Orders form

l     Forms![Orders]![OrderID]

•    The OrderID control on the open Orders form

l     Reports![Invoice]![WarehouseName].Visible

•    The Visible property of the WarehouseName control on the Invoice report

l     In short, the exclamation point separates elements of a collection and the period indicates that what follows is an Access-defined property or method.

Creating Switchboards

l    Switchboard - An unbound form that is used to navigate to other forms, queries and reports in the database.

•    should be planned out way in advance of actually creating them in Access. 

•   The database developer should sit down, away from the computer, and determine what forms, queries, and reports will need to be opened by the user. 

•   The developer will want to consider the most logical arrangement of the switchboard controls and whether more than one switchboard will be required.

Working with Macros

l     Macro - A command or series of commands that you want Access to perform automatically for you

•    Actions - The commands in a Macro.

l      Macros in Access are different from Macros in the other Office applications.

•     In Excel, any action can be recorded in an Excel macro, can be repeated by running the recorded macro. 

•     In Access there is no macro recorder. A macro is collection of predefined commands called actions.  Macros are usually “triggered” when a particular event takes places.

•     VBA is an Event-driven programming language.

•     list of arguments for the OpenForm actions

•   every action has its own set of arguments

Naming Macros and Macro Groups

l    Develop standard naming convention for macros and macro groups

l    Name an individual macro according to name of object initiating macro followed by object’s event property

•    Example: if click event of command button named cmdNext executes a macro
(macro name is cmdNext_Click)

l    Macro group name same name as form associated with preceded by letter “m”

•    mcrGlobal – name used for group of generic macros used in many different forms and reports

Events

l    Event – specific action recognized by an object

•    Each event has an associated event property that specifies how an object responds when event occurs

•   Event properties listed in property sheet of forms, reports, and sections of them

•   Can specify name of macro or VBA procedure in the event property of an object causing it to run when the event occurs

•    Event-driven programming – use of event properties to run macros or to execute VBA code.

Arguments for OpenForm action

l      Form Name – name of the form to open

l      View – Form, Design, Print Preview, Datasheet, PivotTable, or PivotChart

l      Filter Name – specify name of a filter saved as query to filter records

l      Where Condition – SQL WHERE clause (without the word WHERE) selects records

l      Data Mode – settings correspond to form properties Allow Edits, Allow Deletions, Allow Additions, and Data Entry

l      Window Mode – Minimized (Icon), Hidden, Dialog (set Modal and Pop Up properties to Yes)

•     Modal – cannot use other open windows until current window closed

•     Pop Up – form stays on top of other open windows  

Figure 4-27 Creating Macros for the Option Group

Event-Driven Programming

l      Event  - A specific action recognized by an object when it occurs on or with that object, and for which you can define a response (Click, Double-Click, Right-Click)

l      Event Property - A property that specifies how an object responds when an event occurs

l      Event-Driven Programming - The use of event properties to run macros or to execute VBA code

l      Event Procedure - A group of statements that execute when an event occurs, and is part of a larger category of procedures called sub procedures.

IFS 110 Computer Assignment 4

REVIEW ASSIGNMENTS
AC pages 177-179

Return to IFS 110 Notes!