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.

Recommended Answers

All 5 Replies

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

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?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.