View Full Version : How Do I create mutiple choice questions


danielbullimore
04-21-2007, 03:54 AM
I'm making a project in VB, and I need it to link to a Database,I already know how to do this
the project is a bit like who wants to be a millionaire with all the questions in an access table,
I know I need the following fields;

the auto number
the question
Answer A
answer B
answer C

the problem is I need to be able to select which answer is correct ?

The_Doc_Man
04-21-2007, 08:18 PM
If you use that design, your table will not be normalized.

If each question is properly numbered (uniquely) then you can use that number as a key in a one//many relationship.

tblQuestions
QID, prime key, probably autonumber is OK
QText, text, the question

tblQAnswers
QAId, prime key, probably autonumber is OK
QID, foreign key, LONG, links back to corresponding QID
QAText, text, the answer
QAOridinal, number, the displayed question number.
QARight, yes/no, marker - this answer is correct.

Then you can build a report by JOINing these two tables across the question ID, group by question ID, sort (ORDER BY) QID first, QAID second. The report can put the question in a field header. The answers would go into the detail section.