Hello!~
i'm currently doing a database about examination system.. i already have a database for login,registration, and questionaires.
my problem is on my question database.. i managed to connect the questions and choices in visual basic (or so i thought) questions are on multiple choices.. my question is : how can i put a value on the right answer. let's say, if the answer for a question is option 1 and the user chooses option two.. it should produce a "0" score.

Edited 2 Years Ago by Lacrecen: added image

Attachments untitled.JPG 7.97 KB 2.JPG 18.21 KB

In table create a field for right answar. After chooeing option it will compare with the right answar. And if return value =True then score=1 else 0.

Ensure that you have normalized your database fields and tables properly. You actually need (at least) two tables to store your multiple-choice questions: Questions and Answers. Questions will have the question number (primary key), title(optional), question text and the correct answer number(s). You could add other fields, but make sure they are related to the Question, and not an answer. The second table is for your answers, which will have the question number (foreign key), answer number, the answer text, and optionally other fields related to the questions. The question number and answer number together are the composite primary key.

When a user gives a response, compare the user's answer with the correct answer for the question. If they match, then add 1 to the score; otherwise don't.

If there is specific code that is giving you problems, please post it and we can give more specific advise.

i forgot to mention that i'm a beginner when it comes to database.I need to familiarize myself with terms like primary key, foreign key, return value, modules, classes and the like.I googled those terms and I'm learning byte by byte. Still have a long way before i master vb6 >.<

anyway, thank you for the reply!
my approach so far is this (w/o applying complicated code and based from my "logic"):

coding for form2:

Private Sub Command1_Click()
Label7.Caption = Label2.Caption
End Sub

Private Sub Command2_Click()
Label7.Caption = Label3.Caption
End Sub

Private Sub Command3_Click()
Label7.Caption = Label4.Caption
End Sub

Private Sub Command4_Click()
Label7.Caption = Label5.Caption
End Sub

Private Sub Command5_Click()
If Label7.Caption = Label6.Caption Then
Form3.Label1.Caption = Val(Form3.Label1.Caption) + 1
End If

Adodc1.Recordset.MoveNext
End Sub

Private Sub Command6_Click()
Form3.Show
End Sub

Edited 2 Years Ago by Lacrecen

Attachments untitled.JPG 20.06 KB untitled2.JPG 55.44 KB untitled3.JPG 43.31 KB untitled4.JPG 12.82 KB

I do not think you need a second form (Form3) just to keep the score. You could do that on the main form. Otherwise, this looks like it should work. Is there a specific problem with it?

Edited 2 Years Ago by Nutster: Add question.

none so far. but i will be asking more questions in the future. thanks for now!~

This article has been dead for over six months. Start a new discussion instead.