Setting up tables for grades


G

Gntlhnds

I do not understand why I am not understanding this, but I am trying to set
up a form for inputing student grades. There are 13 classes that I need to
track grades for (currently) as well as a composite grade. I have a table
(tblStudents) with the student information (including [StudentID]), a table
(tblCourses) with course names(two fields, one [CourseID], the other
[Course]), and a table (tblCourseGrades) to keep track of the grades
([GradeID], [StudentID], [CourseID], [Grade]). I'm thinking I'm
understanding relational design and I have the table set-up correct, but
designing the form for inputing the grades I'm just not getting for some
reason or another. I have a combo box that selects the student, and then a
subform (datasheet view) with tblCourseGrades as its source. This is not
working. The subform only shows one blank row. Any help to straighten out
my understanding would be appreciated. I've tried reading various tutorials
on relational design and normalizing, but there is something that I'm just
not getting. Thanks in advance.
 
Ad

Advertisements

D

Daryl S

Gntlhnds -

Have you assigned the students to the courses? That is, have you populated
the tblCourseGrades table with all the combinations of studentID and CourseID
that make sense? I don't know if this is like an elementary school where
all students in each grade (say 3rd grade) take the same courses (reading,
writing, and arithmetic), or like in college where every student may have a
unique combination of courses.

I don't see the concept of class versus course - this would be the
difference between the course (English 101) and the classes (English 101
taught MWF in Room 12 at 9:00 versus English 101 taught MWF in Room 23 at
10:00, including which semester or quarter they are taught). You didn't
provide details on your requirements, so I don't know if that needs to happen.

In any case, a student must be assigned to a class before they can get a
grade in the class. If you need more help, please provide more information...
 
G

Gntlhnds

Thanks for the response. The best way to describe my situation would be like
an elementary school, where each class takes the same courses at the same
time. And, no, my tblCourseGrades is not populated with the courses and
students. I'm assuming I would use a query to do this, but how would I work
that? I have classes starting about every two weeks or so, and each class
takes the same courses, so I would need to frequently update that table. I
hope this is enough information. Thanks.
 
K

KARL DEWEY

I have a combo box that selects the student, and then a subform (datasheet
view) with tblCourseGrades as its source.
I would use a form to select [Class] and [CourseID]. If records did not
exist then run an append query to create the records. When exist display in
subform for grade entry using listbox. Include in choices something to
indicate missed evaluation.

tblStudents –
[StudentID]
[FName] -
[LName] -
[Class] -

tblCourses -–
[CourseID] -
[Course] –

tblCourseGrades –
[GradeID] –
[StudentID] –
[CourseID] –
[Grade] –
[Comment] -
 
J

John W. Vinson

Thanks for the response. The best way to describe my situation would be like
an elementary school, where each class takes the same courses at the same
time. And, no, my tblCourseGrades is not populated with the courses and
students. I'm assuming I would use a query to do this, but how would I work
that? I have classes starting about every two weeks or so, and each class
takes the same courses, so I would need to frequently update that table. I
hope this is enough information. Thanks.

A Query probably will be involved, but you would (I would guess!) need to pick
somebody's brain for the information that Alisia Gonzalez is assigned to the
Management Development class starting May 3. Normally one would do this using
a form and subform arrangement; this could be done in two ways - you could
have a form based on the table of students with a subform based on what I'd
call the "class enrollment" table, allowing you to pick whichever classes this
student needs. Alternatively (or in addition) you could have a form based on
the class table, with a subform allowing you to pick students from a combo box
to enter them into the enrollment table.
 
G

Gntlhnds

This is what I am trying to do. I have a form whose source is tblStudents
with a combo box that selects the student. I then have a subform whose
source is tblCourseGrades as a datasheet. I have two field, Course and
Grade. Course is a combo box with tblCourses as it's source to select the
Course. This is not working for me, though. Becasue tblCourseGrade does not
have a Course field, I have to have the combo box unbound, which does not
work. If anyone has any idea as to how I should properly setup this subform,
I would greatly appreciate it. Thanks.
 
Ad

Advertisements

G

Gntlhnds

Really what I would like is to have the subform list all of the courses with
the ability to add the grade once the student completes the course, then I
can create reports to output the grades either by student or class, including
a composite grade.
 
J

John W. Vinson

This is what I am trying to do. I have a form whose source is tblStudents
with a combo box that selects the student. I then have a subform whose
source is tblCourseGrades as a datasheet. I have two field, Course and
Grade. Course is a combo box with tblCourses as it's source to select the
Course. This is not working for me, though. Becasue tblCourseGrade does not
have a Course field, I have to have the combo box unbound, which does not
work. If anyone has any idea as to how I should properly setup this subform,
I would greatly appreciate it. Thanks.

Well... if you want to record the course grade for a student, you must - no
option, no choice - record SOMEWHERE what course the grade is for!!! Why
doesn't tblCourseGrade have a Course field? What is its structure?

The problem isn't your form. It's your table.
 
J

John W. Vinson

Really what I would like is to have the subform list all of the courses with
the ability to add the grade once the student completes the course, then I
can create reports to output the grades either by student or class, including
a composite grade.

Don't confuse data *DISPLAY* - a subform - with data *STORAGE* - a table.

Data is NOT stored in forms. It's stored in tables, and only in tables. You
can display multiple courses on the form if you like, but it sounds like
you're assuming that the grade is being put into the form. It's not; you're
using the form as a tool to put the grade (and the student ID and the course)
into a Table. You can then use queries and reports to pull the data back out
of that table in any form or combination you like.
 
D

Daryl S

Gntlhnds -

Like John said, you could use a query or a form to assign students to their
classes. If all students that come through your school take the same
courses, and in the same order, or they all start on the same day, and all
students take all 13 of your courses, then you can write a query to append
the records when the student is added. I worry that your design is not very
flexible, and that if something changes you will need to do a lot of rework.
Some things to consider (you can choose what you want to implement depending
on your business model):

1. You really offer two programs, some classes of students are in program A
that take courses a100, a200, a300, a400, and a500, while some classes of
strudents are in program B that take courses b100, b200, b300, b400, b500,
b600, b700, and b800. If this case, you need to create a programs table and
assign courses to the programs (maybe course a100 is given in both programs
because it is an introduction class). Then when you set up your student, you
assign them a program, and you can use a query to append the records for each
student based on the program.

2. Some students will take only some of the classes. You don't want to
show students in a class with no grades if they don't take the class. If
your classes are, say, 2 weeks each, and the program is supposed to last 26
weeks, then some students may drop out after week 10. In this case, you
don't want to assign all students to all courses up front. Maybe all 13
courses are taught in 1/2-hour blocks every day, so all students really do
start all classes. Then you would assign them all up front...

3. I really think you will want some dates in your tables. If the courses
are taken sequentially, then you may want to include the course start date in
your tblCourseGrades (which I am thinking is more like a tblCourseEnrollment,
one attribute of which would be the final grade). A completion date would be
good unless that can always be determined from the start date (e.g. your
programs always take 6 weeks to complete).

Anyway, if you just want to add all courses for each new student with your
current structure, then you could add a button on the form you use to add a
student, and clicking the button could run a query like this (use your form
and control name to get the current StudentID from the form):

INSERT INTO tblCourseGrades(CourseID, StudentID)
SELECT CourseID, Forms!StudentForm!txtStudentID
FROM tblCourses;

If you can provide more details, we can provide more help...
 
G

Gntlhnds

I was thinking the problem was my tables. Here's my current structure:

tblStudents:
StudentID
Last Name
First Name
Class #

tblCourses:
CourseID
Course

tblCourseGrades:
GradeID (Primary Key)
StudentID (Foreign Key)
CourseID (Foreign Key)
Grade

tblStudents has other fields, but those are the only ones that pertain to
setting up the grades. I know the naming convention for the field names
isn't proper, but I inherited the database and I'm afraid of changing the
field names because it might cause many other things to fail in the database.

Here's how my school operates:
Student shows up and is assigned to a class. The class takes the 13 classes
sequentially. A few weeks later some more students show up, are assigned to
a class, and they start the courses as well, taking them sequentially.
Hopefully that helps clear up what I'm looking for and expecting. I was
thinking I could just create a form that I could select the student from a
combo box, and the subform would list the courses and allow me to input the
student's grade for each class (to be stored in tblCourseGrades). Then I
would create report(s) that would allow me to take those grades and output
them in various formats (one individualized for the student, one for the
class, and then whatever other ones I get tasked to provide). I really do
thank you for helping me out and trying to make me understand how this is
really supposed to work.
 
Ad

Advertisements

J

John W. Vinson

I was thinking the problem was my tables. Here's my current structure:

tblStudents:
StudentID
Last Name
First Name
Class #

What's Class#? I'd remove the blanks from the fieldnames and avoid using # -
it's a date delimiter and can cause problems in fieldnames. If you do keep
them you must ALWAYS use [square brackets] around the fieldnames.

tblCourses:
CourseID
Course

tblCourseGrades:
GradeID (Primary Key)
StudentID (Foreign Key)
CourseID (Foreign Key)
Grade

That appears to be correct. You might want to create a unique twofield index
on StudentID and CourseID to prevent one student from being signed up to the
same course twice.
tblStudents has other fields, but those are the only ones that pertain to
setting up the grades. I know the naming convention for the field names
isn't proper, but I inherited the database and I'm afraid of changing the
field names because it might cause many other things to fail in the database.

Here's how my school operates:
Student shows up and is assigned to a class. The class takes the 13 classes
sequentially. A few weeks later some more students show up, are assigned to
a class, and they start the courses as well, taking them sequentially.
Hopefully that helps clear up what I'm looking for and expecting. I was
thinking I could just create a form that I could select the student from a
combo box, and the subform would list the courses and allow me to input the
student's grade for each class (to be stored in tblCourseGrades). Then I
would create report(s) that would allow me to take those grades and output
them in various formats (one individualized for the student, one for the
class, and then whatever other ones I get tasked to provide). I really do
thank you for helping me out and trying to make me understand how this is
really supposed to work.

You're doing OK. I'd suggest basing a Form on tblStudents; use the combo box
wizard to create an unbound combo on the form to navigate to a particular
student's record (use the option "Use this combo to find a record" in the
wizard).

On the form you would put a Subform based on tblCourseGrades. This subform
would use the StudentID as the master/child link field, and have a combo box
for the CourseID; the combo's rowsource would be the Courses table to let you
pick which courses for that student. The combo will show all the courses. Next
to the combo you'ld have a textbox to enter the grade.
 
G

Gntlhnds

Man, this helped so much. This is what I started to try to do, but for some
reason I couldn't get the darn thing to work properly. Your step-by-step
instructions was just what I needed.

About the naming conventions, I unfortunately inherited this database, so
normally I would try to adhere to them, however, I'm afraid that if I change
the names of things, they wouldn't propagate properly. I've already tried
renaming various forms, tables, reports, and queries, and things ended up not
working, and I'd spend hours going back through trying to find places where
the changes didn't propagate.
 
J

John W. Vinson

Man, this helped so much. This is what I started to try to do, but for some
reason I couldn't get the darn thing to work properly. Your step-by-step
instructions was just what I needed.

Glad to have been of help, and good luck with the database! Don't hesitate to
post back if you still have problems.
 
G

Gntlhnds

I am actually having another problem. I'm trying to do a report and in the
footer of StudentID I have an unbound text box to calculate the average grade
for each student. Here is the formula I'm using: =Avg(IsNumeric([Grade])).
It doesn't return the correct grade (-0.825), and it gives the same answer
for each student. Any thoughts? I know this is the Forms thread, so I can
move this question to the Reports if need be.
 
J

John W. Vinson

I am actually having another problem. I'm trying to do a report and in the
footer of StudentID I have an unbound text box to calculate the average grade
for each student. Here is the formula I'm using: =Avg(IsNumeric([Grade])).
It doesn't return the correct grade (-0.825), and it gives the same answer
for each student. Any thoughts? I know this is the Forms thread, so I can
move this question to the Reports if need be.

IsNumeric() is a function which returns True (-1) if the value in [Grade] is
numeric, and False (0) if it isn't. Your expression isn't averaging the
grades; it's averaging the -1's and 0's, not what you want at all!

Try

=Avg(IIF(IsNumeric([Grade]), [Grade], Null)

This will check to see if the field is numeric; if it is it will include it in
the average, if it isn't the NULL will be ignored in the average.

Why the need to check? What does the Grade field contain that isn't numeric,
and why are you trying to average non-numeric values?
 
Ad

Advertisements

G

Gntlhnds

I know it has been a while since this post was made, but I've finally been
able to devote some time into trying to finish this. I've run into a
problem, though.

In my subform, I have a datasheet with two columns, Course and Grade.
Course is a combo box with CourseID as its control sourse (from
tblCourseGrades), its row source is tblCourses, its bound column is 1, it is
set up with two colums, column widths being 0";1". Grade has its control
sourse as Grade from tblCourseGrades. The problem comes when I try to select
the course to input a grade for it. It won't let me select any course and
tells me in the lower left of the screen "control can't be edited; it's bound
to AutoNumber field "ControlID". If I try to make it an unbound control,
then the courses column appears blank, and when I try to select a course, it
makes that the course for all the records in the datasheet. If I try to use
Course from tblCourses as its control source, I get a message that pops up
when I try to select a course that says "Field cannot be updated", and if I
click "ok" on that it will leave my input as it is, and if I go to another
record and back to that original record, it will allow me to input a grade.
The side effect is that in tblCourseGrades there is a new record, but nothing
in the StudentID field, and tblCourses has a new record that isn't supposed
to be there. What do I need to do to get this seemingly straightforward form
to work properly? Thanks for the help.

John W. Vinson said:
I was thinking the problem was my tables. Here's my current structure:

tblStudents:
StudentID
Last Name
First Name
Class #

What's Class#? I'd remove the blanks from the fieldnames and avoid using # -
it's a date delimiter and can cause problems in fieldnames. If you do keep
them you must ALWAYS use [square brackets] around the fieldnames.

tblCourses:
CourseID
Course

tblCourseGrades:
GradeID (Primary Key)
StudentID (Foreign Key)
CourseID (Foreign Key)
Grade

That appears to be correct. You might want to create a unique twofield index
on StudentID and CourseID to prevent one student from being signed up to the
same course twice.
tblStudents has other fields, but those are the only ones that pertain to
setting up the grades. I know the naming convention for the field names
isn't proper, but I inherited the database and I'm afraid of changing the
field names because it might cause many other things to fail in the database.

Here's how my school operates:
Student shows up and is assigned to a class. The class takes the 13 classes
sequentially. A few weeks later some more students show up, are assigned to
a class, and they start the courses as well, taking them sequentially.
Hopefully that helps clear up what I'm looking for and expecting. I was
thinking I could just create a form that I could select the student from a
combo box, and the subform would list the courses and allow me to input the
student's grade for each class (to be stored in tblCourseGrades). Then I
would create report(s) that would allow me to take those grades and output
them in various formats (one individualized for the student, one for the
class, and then whatever other ones I get tasked to provide). I really do
thank you for helping me out and trying to make me understand how this is
really supposed to work.

You're doing OK. I'd suggest basing a Form on tblStudents; use the combo box
wizard to create an unbound combo on the form to navigate to a particular
student's record (use the option "Use this combo to find a record" in the
wizard).

On the form you would put a Subform based on tblCourseGrades. This subform
would use the StudentID as the master/child link field, and have a combo box
for the CourseID; the combo's rowsource would be the Courses table to let you
pick which courses for that student. The combo will show all the courses. Next
to the combo you'ld have a textbox to enter the grade.
 
Ad

Advertisements

G

Gntlhnds

I don't know how I missed my subform not being bound to tblCourseGrades. I
thought it was, but it had a SELECT statement as its record source. Thanks
for the help. Now it is working the way that it should.

BruceM via AccessMonster.com said:
When asking about forms you should always describe the Record Source. Going
back to the table structure:

tblStudents:
StudentID
Last Name
etc.

tblCourses:
CourseID
Course

tblCourseGrades:
GradeID (Primary Key)
StudentID (Foreign Key)
CourseID (Foreign Key)
Grade

Click View >> Relationships. There should be a relationship between the two
StudentID fields, and between the two CourseID fields. The linking fields in
tblCourseGrades need to be the same data type as in tblStudent and tblCourses,
except that if CourseID in tblCouse is autonumber, it needs to be Long
Integer in tblCourseGrades.

Your main form is bound to tblStudent, and your subform to tblCourseGrades.
In design view, click the subform control (the "box" on the main form that
contains the subform), and click View >> Properties. Be sure the Link Child
and Link Master properties are set to StudentID, as it is the linking field
between the two tables.

On the subform, the Course combo box is bound to StudentID. Remember, the
subform is bound to tblCourseGrades only, so the combo box has CourseID in
tblCourseGrades as its Control Source. The Row Source for the combo box is
tblCourse, with CourseID as the first (hidden) column and Course as the
second (visible) column. The Bound Column for the combo box is 1, and the
Column Count is 2. It sounds like you have the combo box set up correctly,
but I am just reviewing.

tblCourseGrades serves two purposes: It lets you assign students to classes,
and when the class is complete it lets you assign grades. Before the grades
are assigned you can use it to produce a listing of students who are supposed
to be there (so you can take attendance, or whatever). You would do this by
either creating a report based on tblCourse, with a subreport based on
tblCourseGrades; or you could make a query that includes tblCourse and
tblCourseGrades. Make a report based on this query, and group the report
(View >> Sorting and Grouping) by CourseID.

When you say your subform has a datasheet with two columns, I assume you mean
your subform uses Datasheet as the Default View.

It sounds as if your subform may be bound to something other than
tblCourseGrades.
I know it has been a while since this post was made, but I've finally been
able to devote some time into trying to finish this. I've run into a
problem, though.

In my subform, I have a datasheet with two columns, Course and Grade.
Course is a combo box with CourseID as its control sourse (from
tblCourseGrades), its row source is tblCourses, its bound column is 1, it is
set up with two colums, column widths being 0";1". Grade has its control
sourse as Grade from tblCourseGrades. The problem comes when I try to select
the course to input a grade for it. It won't let me select any course and
tells me in the lower left of the screen "control can't be edited; it's bound
to AutoNumber field "ControlID". If I try to make it an unbound control,
then the courses column appears blank, and when I try to select a course, it
makes that the course for all the records in the datasheet. If I try to use
Course from tblCourses as its control source, I get a message that pops up
when I try to select a course that says "Field cannot be updated", and if I
click "ok" on that it will leave my input as it is, and if I go to another
record and back to that original record, it will allow me to input a grade.
The side effect is that in tblCourseGrades there is a new record, but nothing
in the StudentID field, and tblCourses has a new record that isn't supposed
to be there. What do I need to do to get this seemingly straightforward form
to work properly? Thanks for the help.
I was thinking the problem was my tables. Here's my current structure:
[quoted text clipped - 51 lines]
pick which courses for that student. The combo will show all the courses. Next
to the combo you'ld have a textbox to enter the grade.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top