0% found this document useful (0 votes)
43 views10 pages

Quiz

The document describes code for three forms that create a quiz application. Form 1 loads a database and recordset and allows navigating to Form 2. Form 2 displays quiz questions from the recordset, tracks the selected answer and score, and navigates to Form 3 when finished. Form 3 displays the final score. The forms work together to present a timed, multiple choice quiz from a database and track the user's progress and results.

Uploaded by

arulalanhacker
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views10 pages

Quiz

The document describes code for three forms that create a quiz application. Form 1 loads a database and recordset and allows navigating to Form 2. Form 2 displays quiz questions from the recordset, tracks the selected answer and score, and navigates to Form 3 when finished. Form 3 displays the final score. The forms work together to present a timed, multiple choice quiz from a database and track the user's progress and results.

Uploaded by

arulalanhacker
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

FORM 1:-

Dim db As Database

Dim rs As Recordset

Private Sub Form_Load()

Set db = OpenDatabase("D:\johney vb\QUIZ\quiz\qa.mdb")

Set rs = db.OpenRecordset("r")

End Sub

Private Sub Image1_Click()

Unload Me

End Sub

Private Sub Image2_Click()

Form2.Show

End Sub

FORM 2:-

Dim db As Database

Dim rs As Recordset

Public r As String

Dim a As String

Dim res As Integer


Private Sub Command1_Click()

Timer1.Enabled = False

On Error GoTo ex

If rs.Fields(5) = a Then

res = res + 1

Label2.Caption = res

End If

rs.MoveNext

Label1.Caption = rs.Fields(0)

Option1.Caption = rs.Fields(1)

Option2.Caption = rs.Fields(2)

Option3.Caption = rs.Fields(3)

Option4.Caption = rs.Fields(4)

Option1.SetFocus

ex:

If Err.Number = 3021 Then

Form3.Show

Me.Hide

Form3.Text1.Text = res

End If

Timer1.Enabled = True

End Sub

Private Sub Form_Load()


Set db = OpenDatabase("D:\johney vb\QUIZ\quiz\qa.mdb")

Set rs = db.OpenRecordset("r")

rs.MoveFirst

Label1.Caption = rs.Fields(0)

Option1.Caption = rs.Fields(1)

Option2.Caption = rs.Fields(2)

Option3.Caption = rs.Fields(3)

Option4.Caption = rs.Fields(4)

End Sub

Private Sub Option1_GotFocus()

a = Option1.Caption

End Sub

Private Sub Option2_GotFocus()

a = Option2.Caption

End Sub

Private Sub Option3_GotFocus()

a = Option3.Caption

End Sub

Private Sub Option4_GotFocus()

a = Option4.Caption

End Sub

Private Sub Timer1_Timer()


On Error GoTo ex

Beep 1000, 250

If rs.Fields(5) = a Then

res = res + 1

Label2.Caption = res

End If

rs.MoveNext

Label1.Caption = rs.Fields(0)

Option1.Caption = rs.Fields(1)

Option2.Caption = rs.Fields(2)

Option3.Caption = rs.Fields(3)

Option4.Caption = rs.Fields(4)

Option1.SetFocus

ex:

If Err.Number = 3021 Then

Timer1.Enabled = False

Form3.Show

Form3.Text1.Text = res

Me.Hide

End If

End Sub

FORM 3:-
Private Sub Form_Load()X

End Sub

Private Sub Image1_Click()

End

End Sub
TEST MANAGER

You might also like