Multi Choice Questions Code

S

samm

Hi for all

I have multi choise questions Form

when I choose the answer on all groubs by option button,
I want save all answer in text(T4) ,
My problem I get one answer only for last choose at the
last groub in the text(T4)

The Main answer text is ( CORRECT ANSWER or WRONG ANSWER
AND THE CORRECT ANSWER IS 64 xxxxxxxxxxxx

------------------------------------------
I used this code:

Option Compare Database
Dim intQ1 As Integer, intQ2 As Integer, intQ3 As Integer

Private Sub Frame1_AfterUpdate()
intQ1 = 0
Select Case Me!Frame1

Case 1
intQ1 = 1


Let T4 = T4 & vbCrLf & " CORRECT ANSWER "

Case 2



Let T4 = T4 & vbCrLf & "WRONG ANSWER AND CORRECT IS 30"
Case 3
Let T4 = T4 & vbCrLf & "WRONG ANSWER AND CORRECT IS 30"

Case Else
MsgBox (?Error)

End Select
Me!T1 = dValue

T1 = intQ1 + intQ2 + intQ3

End Sub
Private Sub Frame13_AfterUpdate()
intQ2 = 0
Select Case Me!Frame13

Case 1
intQ2 = 1
Let T4 = " CORRECT ANSWER "
T4 = T4 & vbCrLf & "CORRECT ANSWER"
Case 2

Let T4 = "WRONG ANSWER AND CORRECT IS 42"
Case 3
Let T4 = "WRONG ANSWER AND CORRECT IS 42"

Case Else
MsgBox (?Error)

End Select
Me!T1 = dValue
T1 = intQ1 + intQ2 + intQ3

End Sub

Private Sub Frame22_AfterUpdate()
intQ3 = 0
Select Case Me!Frame22

Case 1

Let T4 = "WRONG ANSWER AND CORRECT IS 64 "

Case 2
intQ3 = 1
Let T4 = " CORRECT ANSWER "
Case 3
Let T4 = "WRONG ANSWER AND CORRECT IS 64"

Case Else

MsgBox (?Error)

End Select

Me!T1 = dValue
T1 = intQ1 + intQ2 + intQ3

End Sub
----------------------------------
for example:

Q1. 5X5=
A 25
B 22
C 20

Q2. 5X6=
A 25
B 30
C 20

Q3 6X7=
A 42
B 44
C 56

when I select Q1 option A the text answer1(CORRECT
ANSWER) come in T4

then I select Q2 option A the text answer2(WRONG ANSWER
AND CORRECT IS B) come in T4 instead of text answer1
(CORRECT ANSWER)

then I select Q3 option A the text answer3(CORRECT
ANSWER) come in T4 instead of text answer2 (WRONG ANSWER
AND CORRECT IS A)

at the end I get only this text (CORRECT ANSWER) in T4

But I like to get all answer in T4 as:
answer1(CORRECT ANSWER)
answer2(WRONG ANSWER AND CORRECT IS B)
answer3(CORRECT ANSWER)
 
D

Douglas J. Steele

First of all, you don't need to use the Let keyword when you're assigning
values to variables in a routine.

Check through your code again. There appear to be numerous places where you
only have T4 = "xxx", rather than T4 = T4 & "xxx"

Also, where have you defined T4? I would have expected to see a Dim T4 As
String at the beginning, right after Dim intQ1 As Integer, intQ2 As Integer,
intQ3 As Integer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top