Ronniie
asked on
Simple Database
My little program is to have 30 multiple choice questions with 5 answers to choose from. Each question is to appear after the selection is made and a cmd button clicked.
I will make the DB in MS Access, should I have 30 tables, that's one for each question or one table containing the whole lot?
I will make the DB in MS Access, should I have 30 tables, that's one for each question or one table containing the whole lot?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
the answer choices should be fields in the second table , not records, and the selected answer plus the correct answer should be in 2 fields with a coded value,
ex: choice A,B, and E --> whole answer is ABXXE
choice A and D --> AXXDX
you can easily do this when the button is clicked.
dim answ as string
answ = IIf(me.chkbox1 = true, "A", "X")
answ = answ & IIf(me.chbox2 = true,"B","X")
.
.
.
regards,
Cedrus
ex: choice A,B, and E --> whole answer is ABXXE
choice A and D --> AXXDX
you can easily do this when the button is clicked.
dim answ as string
answ = IIf(me.chkbox1 = true, "A", "X")
answ = answ & IIf(me.chbox2 = true,"B","X")
.
.
.
regards,
Cedrus
ASKER
Very helpful thanks for your efforts.
To use the 'Correct' column:
In your code, when a person selects their answer, you can check the answer's Correct column. Assuming that the column is numeric, and the selected answer is the current record in the recordset Answers, then the code:
If Answers![Correct] Then
MsgBox "Correct"
Else
MsgBox "Wrong"
End If
In your code, when a person selects their answer, you can check the answer's Correct column. Assuming that the column is numeric, and the selected answer is the current record in the recordset Answers, then the code:
If Answers![Correct] Then
MsgBox "Correct"
Else
MsgBox "Wrong"
End If
The issue is a little bigger than you indicate.
You need to store the 30 questions and 5 multichoice replies, but you also need to store the replies that the user is selecting.
For the questions you can have a single table with either 30 fields (memo type) or 30 records, one per question.
For the replies, you can have a single table with either 5 fields (memo type) or 5 records, one per reply.
The last table would be the replies chosen. That table should have the ID of the user making the selections and the replies that they selected.
If your program will only be used one time then either of the above will work. However, if you plan on having numerous 30 question tests, then the 30 fields per record with an ID associated with the test is the best bet. The 5 multichoice would also carry the test ID and the user replies would carry the userid, the test ID and the replies selected.
QuestionTable
TestID Text 10 char Unique value PrimaryKey
Question1 Memo
Question2 Memo
etc
ReplyTable
TestID Text 10 char Unique value Primarykey
Reply1 Memo
Reply2 Memo
etc
UserReplyTable
AutoID AutoNumber Unique value Primarykey
UserID Text 10 Char Duplicate values Index1
TestID Text 10 Char Duplicate Values Index2
Reply1 Text 1 char These would be Y/N replies
Reply2 Text 1 char These would be Y/N replies
etc
That way you can add new questions, new optional answers and keep the replies for later analysis.
Ask for more help if this isn't clear enough.
Sweat