Question database

kentendresen

Registered User.
Local time
Today, 11:02
Joined
Nov 13, 2002
Messages
49
Hi!

I have made a simple question database, where I have all the questions and four alternative answers to each question saved in a table.

The users can go through all the questions in a multiple choice form, where they can press a radiobutton next to the answer they think is the correct one.

But I don't know how to 'connect' the radiobuttons to the Right Answer Post in the table. When a radiobutton is pressed, it should validate with the Right Answer Post if it is correct or not. And I also need a function which can give a status how many correct answers they got during the test. Can anyone help me?


Thx!
 
Kentendresen-

You could put a field in the questions table containing the correct answer ("RightAnswer"), maybe a number 1-4. Also include in the table a "MyAnswer" field. Give the radio buttons in the option group values 1-4, and bind them to the MyAnswer field.

Now, at any point when the student(?) is taking the test you know (a) how many questions have been answered so far (if a question has been answered the MyAnswer field for the question is not null: DCount("MyAnswer","tblQuestions",Not IsNull(MyAnswer")), and (b) how many questions were answered correctly (DCount("MyAnswer","tblQuestions","MyAnswer=RightAnswer")).

If you want to provide a "progress" button on the form you can save the current record then pop up a form that uses the data in the table to show the number of questions completed and the percent correct, or whatever you want to show. You could also pop up this form when the user clicks a "Done" button or closes the questions form.

I assume you've thought out the problem of how to keep different students/users of the questionnaire straight. 'Course if it's one user at a time you're OK with just the one table.

HTH,
Jim
 
Last edited:
Thank you!

I've done it like you said, but how do I reset the MyAnswer-field in the table? When a new student starts the database, the MyAnswer-field has to be blank, or else will he see the answers from the last user...

Kent Endresen
 
Kent,

If you just want to have a single user of the DB you can reset the "MyAnswer" field in all the questions by doing something like

' DoCmd.SetWarnings False ' Uncomment to suppress warnings about update
DoCmd.RunSQL "UPDATE tblQuestions SET MyAnswer=Null"
DoCmd.SetWarnings True

whenever a new user opens the database.

If you want to support multiple users, let them sign off and sign back in, etc., that's doable, but adds the need for retaining answer sets, providing login capabilities, etc. This will add quite a lot to your development chores if you go this way.

Jim
 
Last edited:
Where to put?

Where shall I put this code:

' DoCmd.SetWarnings False ' Uncomment to suppress warnings about update
DoCmd.RunSQL "UPDATE tblQuestions SET MyAnswer=Null"
DoCmd.SetWarnings True

???

Kent Endresen
 
Kent,

If you have devised a way to let multiple users access your database, then you should have a way to recognize then a new user tries to login. The code I published would go in your procedure for registering new users.

I don't know your level of comfort with VBA coding, but you certainly will need quite a bit of it to be able to support multiple users.

What I've done, in a commercial database, is:

1-Activate a login screen when the database is opened
2-Validate the userID after the uers types it, and a password, and clicks "Login"
3-Set internal variables indicating the logon ID
4-If it's a new user, make a copy of the answer list corresponding to the new user
5-Set linkages between the question set and the logged-in user's answer set.

As I said, not trivial, but not rocket science, either.

Good luck!

Jim
 
The database is not for multiple users, so if you now can tell me the easy way to do it, I will be very happy =)

I just want to know where I shall put the code, I'm not in to VB as you might understand.


Thank you!
 

Users who are viewing this thread

Back
Top Bottom