Beruflich Dokumente
Kultur Dokumente
Create a new database called Exam Management System and design tables as shown below and
save to your H drive
1. Create the 2 tables below following the designs indicated
Make sure you set the Data Type for the Primary Key to Autonumber for the Exam table
2. Create the Form shown below based on the Mentor table. Include all fields and modify the
design as shown below
3. Use the Mentor Details Form to enter the data shown here for the Mentors
4. Import the tables called Student and Subject which you will find in the Exam database on
my website (and perhaps on S also)
Page 1
Una Dooney
Relationships
Create a one-to-many relationship between the Mentor Code fields in the Mentors table and the
Student table. Make sure to enforce Referential Integrity. This means that a Mentor Code cannot
be entered in the Student table unless it exists in the Mentor table or a record of a Mentor cannot
be deleted from the Mentor table if there is reference to it in the Student table
COMBO BOXES
A combo box helps the user to input data more easily when using a form by allowing the operator to
choose data from a list instead of having to key it in.
The Student Registration Form
1
Create a new form linked to the Student table. Add all fields except Finish Date and
Certificate
2
Create a combo box for the Course field
(i)
Delete existing Course field from the form
(ii)
(iii)
(iv)
(v)
4
5
Page 2
Una Dooney
Using the Student Registration Form enter the 5 remaining records at the end of the Student Table
shown in the document on the S drive entitled Student Table or on my website.
Notice that when you select a Mentor Name from the drop-down list, the Mentor Code is entered in
the Student table and not the name
REPORTS
Report 1
1 Create a report that lists students by course (See extract below to use as a guide)
2 Add Firstname, Surname and Course fields to the report
3 Group the report by Course
4 Sort in ascending order of Surname
5 Select an appropriate layout, orientation. Select Corporate as the report style. The report title
is List of Current Students
6 Add a function to calculate the total number of students in each course.
(i)
(ii)
(iii)
We will use the count function which is =count(). This is done by adding a textbox
to the Group Header of your Form Design and typing in exactly what you see below. You
will delete the label that will be automatically produced with the text box
Inside the brackets we have put the name of the field we want Access to count and this
is in square brackets [Surname]. We are using this field but we could have used the
StudentCode field just as well (or any field that would give us the number of students on
the course).
Start with the equals sign (=), enclose any text strings in double quotes " " and use the &
sign to join strings with the predefined count function
Page 3
Una Dooney
Report 2
1. Create a report that lists students by Mentor
2. This report requires fields from the Student table and the Mentor table so we must perform
a query first
3. Create a query based on the Student and Mentor tables. Add Mentor Name from the Mentor
table and the student Firstname, Surname and Course fields from the Student table. Save
the query as Mentors and Students
4. Now create the report based on the query
5. Add all fields to the report
6. Group by Mentor Name
7. Sort in ascending order of Surname
8. Select and layout and orientation. Select Corporate as the style. The report title is Mentor
Groups
9. Add a function to calculate the total number of students in each group
Page 4
Una Dooney
Create a Form linked to the Subject table as you see below. Save the form as Subject Details
Add the Exam table and the Subject table to the Relationships in your database and Save
EXAM REGISTRATION FORM
This form will be used to register students for exams. We need the Exam Number, Student Code,
Subject Code and Exam Period fields.
Because the fields required for the form are based on 2 tables, we need to perform a query and add
the Exam table and the Student table to the Design window so that we can use fields from both
tables in the form
Create a Query
1. From the Student table add the Firstname and Surname fields
2. From the Exam table add Exam Number, Student Code, Subject Code and Exam Period fields
3. Save the query as Join tables for Exam Registration (If you look at the results of this
query you will see an empty table! That is fine as we have no students registered for
exams yet)
Create the Exam Registration Form
1. Create a form based on the Join query you have just saved
2. Add all fields from the query
3. When asked how you want to view your data Select by Exam
Exam Management System Database
Page 5
Una Dooney
4. Give the form the title Exam Registration Form and save the form as Exam Registration
5. Now modify the form to include the following combo boxes
Create the following combo boxes. Remember to delete the old field first before putting in the
replacement. We will use a combo box to look up Student Codes to make it easier when we are
entering data when registering students for exams. The combo box will display the Student Code
and Student Name but will enter the Student Code in the field.
Combo Box 1
1. Create a combo box for the Student Code field
2. Select 'I want the combo box to look up the values in a table or query' and select Student
table
3. Add Student Code, Firstname and Surrname to the Combo box
4. Remove the tick from Hide key column box
5. Select Student Code as the value in the combo box to store in the database and store this
value in the Student Code field
6. Enter Student as the label for the combo box
Combo
1.
2.
3.
4.
5.
6.
7.
Box 2
Create a combo box for the Subject Code field
Select 'I want to look up values in a table or query' and select the Subject table
Add Subject Code and Subject Title to the combo box
This time tick Hide the key column
Store the value in the Subject Code field
Enter Subject as the label for the combo box
View the properties of the combo box and set the Column widths to 0 cm; 10 cm and the
List width to 8 cm. This makes the list wide enough to take any of the subjects on offer
Combo Box 3
1 Create a combo box for the Exam Period field
2 Select 'I will type in the values'. See values below:
Exam Period
(Combo box)
Summer 2003
Christmas 2003
Summer 2004
Christmas 2004
Summer 2005
Christmas 2005
3 Select 'Store values in this field' and select ExamPeriod
4 Name the combo box Exam Period
5 Set the combo box properties as follows:
(i)
Set Limit to List property to Yes
(ii)
Set Tab Stop property to No for Exam number (because the Exam number is Autonumber
so we do not want the cursor to stop at this field on the form)
6 Set tab order to Student Code, Subject Code and Exam Period
7 Save the form again as Exam Registration
Page 6
Una Dooney
From Student table add Student Code, Firstname, Surname and Course fields
Page 7
Una Dooney
From the Exam table add Exam Number, Exam Period, Exam Date and Result fields
This is just
an extract
from the
query
design
To create a parameter query we key in a message in the Criteria line of the query design screen. If
we want the query to display the message 'Enter Exam Period' and 'Enter Subject Title' when it is run
we enter those exact messages on the Criteria line as shown here (Make sure you enclose the
message in the square brackets as shown and in the correct column). Each time you run the query
you will be prompted for the criteria you wish to use. The query will then find all exam
registrations relating to the exam period and subject title entered when the query is run.
Save the query as Find student registrations by subject
Test the query by entering Summer 2003 and Programming as the criteria and you should get
5 records
Test again with Summer 2003 and Communications and you should get 20 students as all
students must do Communications
Run it again with Summer 2003 and Web Authoring. You will find that there are no students
are registered for this subject in this exam sitting
Create a Report
1 Create a report based on the Find student registrations by subject query
2 Add the Subject Title, Exam Period, Firstname, Surname and Course fields
3 Sort in ascending order of Student Code
4 Select Corporate style
5 Title is Exam Lists by Subject
6 In Design view move the Subject Title and Exam Period fields to the report header area
7 Include the college address in the report header (Copy it from an existing Form if you can)
8 Draw a label box in the report header area and enter a message for students who are not
registered for the exam that says:
If you would like to sit this exam but your name is not listed
below, please contact your Mentor as soon as possible
9 Test the report by entering a different subject each time. Remember that each time you run
the report the query must run first so you will be prompted for the parameters of the report
you want.
10 The Subjects that you have are only those listed in your Subject table and are Programming,
Software Development, Web Authoring, Communications, Graphic Design etc.
(i)
The Courses we have (just 3) are Computer Programming, Web Design and Information
Technology
(ii)
Make sure that when you are running the report you enter one of the Subjects as that is
the field we have in the report and not the Course
11 Preview the report and you should get something like this if you choose the parameters
Summer 2003 as the Exam Period and Programming as the subject
12 We will now use a Function to count the number of students that are registered for a
particular exam and display it in the report header area
(i)
Create a text box (later you can delete the text box label). DO NOT use a label box or
this will NOT work
(ii)
Enter the following in the text box exactly as you see it
=There are & count([Surname]) & students sitting the & [SubjectTitle]&
exam
Exam Management System Database
Page 8
Una Dooney
This should place a message at the end of the Report that you see below
Report shown is of students who have registered for Graphic Design in the Christmas 2003 exams.
EXERCISES
1. Create a report for the students who have registered for the Summer 2003 exam in Information
and Communication Systems
2. Create a report for the students who have registered for the Christmas 2003 exam in Spreadsheet
Methods
In the New Report window select Label Wizard and choose the query Find student registration by
subject and Click OK
Page 9
Una Dooney
3
4
5
6
7
8
9
10
Labels can also be produced to address envelopes with student results and for lots of other purposes.
It is a useful feature of the database.
CREATE QUERY
For
1
2
3
4
5
6
7
CREATE FORM
1
2
3
4
Page 10
Una Dooney
Set enabled property to No for Student Code, Firstname, Surname, Subject Title and Exam
Period fields (The purpose of this is that these fields cannot be edited when results are being
entered)
Create a combo box for the Results field. Select I will type in the values which are Distinction,
Merit, Pass and Fail. A suggested layout and format are shown here
MACROS
A macro is a series of commands, specified by the user, which can be saved and executed quickly
again by perhaps pressing just one key on the keyboard. Macros can be created to carry out common
tasks such as finding or adding records in a database. Macros can also be used to develop a user
interface by creating custom menus, making it easier and quicker for the database user to carry out
tasks.
In the database we have created there is one disadvantage to the system we have devised for
entering exam results. Because we have linked this operation to a parameter query, each time we
want to enter results from a different exam sitting we have to close the form and open it again and
enter the parameters. We are now going to devise a macro that will solve this little problem.
We will create a macro that will
1 Close the Enter Exam Results form and
2 Open the Enter Exam Results form and ask for the Exam Period and Subject Title for which you
want to enter results
CREATE A MACRO
In the database menu select Macros and New
The following window appears:
Page 11
Una Dooney
We must specify commands in the Action column. When the macro is run the commands will execute
in sequence. A Comment is a short statement describing the function of particular line in the macro.
Its purpose is simply to inform the database user of what the action is intended to achieve! A
comment has no effect on the operation of the macro.
1 Select Close from the Action column
2
3
Save = No relates to saving changes to the design of the form. It does not affect the entering of
records in the form.
Select OpenForm Command
Click on Save and enter Next Set of Results as the name of the Macro
6
7
Check that the control wizard is on and click on the Command Button
Click and drag the mouse to the right of the surname on the form
Page 12
in the toolbox
Una Dooney
8
9
10
11
12
You are asked What action do you want to happen when button is pressed?
Select Miscellaneous
Select Run Macro
Select the Next set of results macro that you have written
A picture or text can be inserted in the command button. Select the text option. Delete Run
macro and type Next Subject and click Next
If your Form
does not look
like this one I
would suggest
you check your
Relationships
and ensure
that all tables
are related to
other tables,
as they should
be
Test the edited form by entering Summer 2003 as the exam period and Communications as the
Subject Title. The form should display 20 records.
Click the Next Subject button. Enter Summer 2003 and Programming. The form should display 5
records.
Close the form without adding any results yet
EDIT A MACRO
We want the form to fill the entire screen when we run it.
Open the Macro "Next set of Results" in Design view
In the line below OpenForm in the Action column select Maximize
Save and Close the Macro
Exam Management System Database
Page 13
Una Dooney
COMMAND BUTTONS
These are buttons that are linked to built-in commands that execute when the button is pressed (A
bit like a Macro but one that is already built in to Access)
Once you draw a Command button on a Form the wizard will bring you through the steps you need
and write the code in the background
Open the Enter Exam Results Form and below the Next Subject button draw a command button
Select Form Operations/Close Form/Next
Select Text option and replace Close Form with Exit. Click Next
Type Close Exam Results button as the name of the button and Click Finish
View the properties of the button and set the Tab Stop to No
Adjust the width and other properties of the Command button until you are satisfied. Save the
changes to your form
Add Exam Period, Exam Date and Result from the Exam table
Add parameters to the query so that it will ask for the Exam Period and the Subject
Title when it is run (We only want to see results for a single subject for a particular
exam period)
Enter conditions that only records where the Exam Date and Results fields are filled in
are displayed
Page 14
Una Dooney
(ii) Move the Exam Period control to the Report Header section under the title (the subject
name)
(iii) Delete all labels etc in the Page Header section
(iv) Add a function that will show the number of results in each category ie No of Distinctions,
No of Merits etc
(v) Continue to modify the report until you get one that looks like the extract shown here
6 This extract from the report that shows student results for Web Authoring exam for Christmas
2003 with the layout you are required to use and the count showing the number of results at
each level
7 Try out the report with different subjects to ensure that it is working properly
Page 15
Una Dooney
See extract from this report below when the Exam Period Christmas 2003 was entered
Page 16
Una Dooney
Page 17
Una Dooney
Above you see one of the Certificates that the report produces. It will produce each certificate on a
separate page and these can be printed to send to students.
From what you have been doing for the past while you will you will have noticed that many reports
are built on the results of queries, so it is very important that you get the tables and fields right for
your query before you attempt doing a report. The question is what do you want the report to show
and it goes from there!
STUDENT LETTERS
Prepare letters to students giving their examination result as per separate handout on Mail Merge
Page 18
Una Dooney
Fig 1
Above you see the Main Menu (the switchboard shown in Fig 1) that we will create. This is what the
user will see when they open the database
However, we are going to develop a multi-page switchboard and we need to create the Data Entry
(Fig 2) and View Reports (Fig 3) switchboards before we can create the links from our Main Menu
(which is the main or default switchboard)
When we click on the Data Entry button we get this screen Fig 2. When we click on View Reports we
will get Fig 3 that you will see later in this document
Fig 2
All we are doing here is putting a user-friendly interface on the database to make it easier for the
user to use and manage
Page 19
Una Dooney
CREATE A SWITCHBOARD
1
2
3
4
5
6
7
In the Switchboard Manager dialog select the Data Entry page and click Edit
11 In the Text box type in the label you want to appear on the screen - I have used Register new
Student
12 In the Command line select Open Form in Add Mode
13 In the Form line select the Student Registration Form
(i)
Open Form in Add Mode allows you to enter data in your database using the chosen form
(ii)
Each item opens a different Form depending on the one you choose in the Form line
14 This will add the Item Register new Students to the Data Entry switchboard as you see here
15 Click New again and add the next item in the list (see the items in Fig 2)
Exam Management System Database
Page 20
Una Dooney
21 Before we leave the Switchboard Manager we need to put a link from the Main Menu switchboard
to the Data Entry switchboard otherwise we will never be able to access it
22 In the Switchboard Manager page click on Main Menu and then Edit
23 Click New and add the 2 entries you see above to the Main Menu
(i)
The Data Entry link should bring us to the Data Entry switchboard
(ii)
The Exit item should allow us to exit out database Close Application
(iii)
Be careful to use the correct operations in the Command line for each item
24 When you are finished adding all these items you will see a Switchboard Form has been added
automatically to the forms section of your database
Page 21
Una Dooney
27 Click on the Data Entry button to see what happens. You should get the menu that looks like
Fig 2
Use the Switchboard Manager to add another switchboard page with the name View Reports (Edit the
Main Menu switchboard and add a New item)
Add the following items to the View Reports switchboard, as before, not forgetting to make the
navigation possible to and from the Main Menu and the View Reports screen
Fig 3
We have just one more job left to complete our Switchboard operation. We want the switchboard to
be what is seen when somebody opens the database. For this we need to create an Autoexec macro.
This will run automatically each time the database is opened
Page 22
Una Dooney
AUTOEXEC MACRO
1
2
3
4
5
6
7
8
Select Macros
Click New (You should now be in Design View)
Select OpenForm in the first line of the action column
Select Switchboard as the form name in the Properties area
For View select Form
Select Maximize command in the second line of the action column. You do not have to set any
other Properties here
Save the macro as autoexec
Test this by closing the database and opening it again. The database should open with the Main
Menu displayed and taking up the whole screen
2. Select the Certification Query as the basis for the new query
3. Add Student Code, Firstname, Surname, Course, Core Module, Vocational Module, Elective
Module and Certificate to the query design grid
4.
5.
6.
7.
Page 23
Una Dooney
We use the Student table to create the form above even though the query Certification Query part 2
had all the required fields. We cannot base a form on the results of a query that has a Totals row
added!
EDIT SWITCHBOARD
1.
2.
3.
4.
5.
Go to the Data Entry switchboard page and add a new item Award Certificates
Move it up so that it is above the Go to Main Menu item
Create the item so that it allows us to edit the Award Certificates Form
Save your database and close it.
Open the database again and, using the table you printed with the 9 student names who are
to be awarded Certificates, use the Award Certificates button on the switchboard and enter
the data (tick Certificate for the 9 students) who have completed the course. The
Certificate box for the students who have not qualified are left blank
6. Save database
7. Look at the Student table. You should see the Certificate box ticked for the 9 students
Go back to Design view and from the menus select Query/Update Query, or click on
in the
toolbar and then select Update query
6 A new Update to row appears in the query design grid
7 Enter =date() in the update-to row of the Finish Date field
8 Save the query as Update finish date
9 Run the query. You will be prompted that 'you are about to update 9 rows'. Click on Yes to
update the records
10 After running the query todays date will have been entered in the Finish Date field for the 9
students in question. Open the datasheet view of the Students table to see if the relevant
students have a date in the Finish Date field. They should have!
Page 24
Una Dooney