Rip-
This will be difficult to do without redesigning your tables. You have
violated first normal form by listing the questions across. You should also
not build a separate table for each quiz or exam. Your database should look
something like:
tblStudents: StudentID, StudentName, etc.
tblPeriods: PeriodID, Subject, etc.
tblStudentPeriods: StudentID, PeriodID, .. other info related to student
enrolled in that period or class
tblExams: ExamID, ExamTitle, Subject, etc.
tblExamQuestions: ExamID, QuestionID, Question, QuestionType, CorrectAnswer
tblStudentExams: StudentID, PeriodID, ExamID, DateTaken, Grade
tblStudentAnswers: StudentID, PeriodID, ExamID, QuestionID, Answer, Correct
(Yes/No)
It would be a simple matter to match tblExamQuestions with tblStudentAnswers
to "grade" each answer with an Update query. Following that, you could
update tblStudentExams with a percentage correct from tblStudentAnswers or
calculate the value in a query.
But that's probably more work than you want to do. With your current
design, you need to add a "Correct" field (Yes/No data type) to each cluster
of Questions in tblQuizn. You also need to add ExamID to the table. Create
another table that contains all the answers for each quiz (with ExamID as
the Primary Key). Update the "Correct" field with a query something like
this:
UPDATE tblQuiz8Answers INNER JOIN tblQuiz8
ON tblQuiz8Answers.ExamID = tblQuiz8.ExamID
SET tblQuiz8.Q01Correct = (tblQuiz8Answers.Q01Answer = tblQuiz8.Q01Answer),
tblQuiz8.Q02Correct = (tblQuiz8Answers.Q02Answer = tblQuiz8.Q02Answer),
...., [same expression for intervening fields]
tblQuiz8.Q25Correct = (tblQuiz8Answers.Q25Answer = tblQuiz8.Q25Answer)
You'll end up with a True (integer -1) in the Correct field for those that
have answers that match the answer template. You can now add those up and
divide by the number of questions to get the "score" or "grade".
--
John Viescas, author
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
Ripper said:
I created a database for my students to take tests on. I love it, it cuts
my grading time down by 75%. What I really want is for Access to grade for
me.
I have tests each based on a table. tblQuiz8 is my latest. There is an ID
field (autonumber), a student ID, Period, and questions 1 - 25. Each record
will hold all the answers for each kiddo for each test/quiz. Most answers
are multi-coice with answers choices A-F or from drop-menus with answer
choices 1-15.
I was playing around with the IIF function, but it is WAY out of my
league. How can I get Access (02) to grade for me? I would love any help I
can get.