More Microsoft Access and Relational
Databases
Table of Contents
1. Create
a Form using the Form Wizard
2. Creating
a Form Using Design View
4. Displaying
Data from One Table to Help Add Data to Another: Adding Instances to tblStudent
6. Refreshing
the Form and Closing the Form
7. Lab
Questions (use to test your understanding, not turned in)
Reading
for Lab:
·
Review Chapter 13
of Fluency with Information Technology:
Foundations and Fundamentals of Information Technology
·
Check out the Database Definitions on the Web Reference page:
http://courses.washington.edu/fit100/au02/webref.shtml
Introduction:
In today’s lab we will look at the presentation layer: creating forms for users to input data and receive data output. (See the first database lab for a brief description of all three levels involved in a complete Relational Database Management System)
Presentation
Services
The interfaces
created to allow users of the Database system the ability to enter data and to
view output of data. A Form is
the typical interface used for input and output of data that is retrieved by a
Query. There are other interfaces in
Access such as Reports and Data Access Pages, but you will only be dealing with
Forms for the first part of Project 3.
Objectives:
TO BEGIN:
Download a copy of your YourName.mdb
database to the desktop from Dante and open it.
If your
database was not closed when you tried to ftp it after the last lab, you will
have an empty file. If this happened,
you will need to work through the first database lab to recreate it.
Today’s lab allows you to work
with a familiar object, the Form. In
Access forms are used for presentation in a manner similar to their use in JavaScript.
Both are intended as a way to present data of some kind to a user or obtain
data from a user in a way that is intuitive and helpful (although not every
form is successful in this endeavor!). The first form will be created
using a wizard. The second and third will be created just in design view.
In addition, you will add combo boxes on one form in order to view data
from two different tables as we add data to a third. You will also:
· Click Next
· Choose a style
·
Click Next
MajorName School_Dept
INFO The
CSE
BIOL The Biology Program
CHEM Chemistry Department
PHYS Physics Department
SPAN Romance Languages and Literature
ART
HIST History Department
· Right click on the form title bar, select Properties
· Make sure the Form object is selected in the window
· Select as the record source the tblAdvisor table from the list.
· Go to View>Fields List on the Menu bar
3.
Manipulate
field properties in Design View
Mel Oyler from Informatics
Alan Borning from Engineering
John Cusak from Art
Vitoli Demetrio from Modern History
Garbonzo Bean from Physics
Go to the Advisor table. Look at the records you just added through
the data entry form.
Now we’ll do something a little
different: create a form that adds data
to the Student table, but it will display data from Major and Advisor tables.
· Add the first combo box to the form by clicking once on the tool.
· Move to the area of the form where you would like to have the combo box and use the “click and drag” action with your mouse to draw the combo box to the size you want on the form.
Once you place the combo box control on your form, a
combo box wizard window will come up to walk you through the process. Select the following options from each screen and then
click Next: You will return to design view. There is now a combo box and label in the
form. The label can be deleted (the
combo box should line up across from the other Major label and text box).
· Have the combo box look up values from a table
· Select the tblAdvisor as the table that will provide values for the combo box.
· Move ONLY the AdvisorID, Lname and Department from the available fields over to the selected fields window.
· Make sure the “Hide key column” box is checked
· Store the value in the “AdvisorID” field of the Student table (those are the options in the drop down menu)
· Ignore the name option for the combo box and click Finish.
You
should see the number value of the Advisor in the text box for Advisor ID
and the name and department of the person that goes with that number
appears in the combo box on the right.
We
have set up the combo box so that it displays the text values for us to
see, but it will store the corresponding key value in the Student table in
the attribute AdvisorID. That stored value will be referred to as
a foreign key in the Student table.
Once you place the list box control on your form, a
wizard window will come up to walk you through the process. Select the following options from each screen and then
click Next: You will return to design view. There is now a list box and label in the
form.
· Does the list box get updated?
·
Are the names in the list box updated in
alphabetical order?
No, they are updated and displayed in the order they were entered to the
table. We’ll look at ways to sort data
alphabetically next lab.
Close your database and FTP it to your Dante account if you don’t already have it on disk. We will use it again for the next lab.
WHEW!!!! You’ve made it through another lab! Only a few more to go!!!!!