Selecting a random record

TomH

Registered User.
Local time
Today, 16:23
Joined
Nov 3, 2008
Messages
111
I'm attempting to build a Q and A testing database for my students. What I would like to do is have a random question fill into a form control, and the student then must fill in the answer in another control. The question and correct answer would be in a table, and the student's answer would be compared to the value in the answer field... resulting in a correct/incorrect counter update until the student has answered all the questions.

I've got a lot of work to on this, but my first question is... how do you populate a form with a random record from a table? I can do it in excel easy... but I'm not familiar with any kind of "random" functionality in access.

Ultimately, I'd like to be able to build a test of random questions taken from a table, so that no two students get the same questions... or they get similar questions with different values. Plus, I'd like the database to grade the test as well.

Thanks for any help!
 
Last edited:
You can use the Rnd function to generate a random number.

I would suggest that you use either an auto number column or some other numeric incrementing method to create a unique number for each question. Then you can use the Rnd function to pick a random number between 0 and the maximum value from your question numbering field, then you can use the random number to select the question. You would repeat this each time you need a question presented to the use. You can even have your form bound to the questions table and just locate the question record based on the random number you are generating.

Just my initial thoughts. I am sure there are more ways of doing this but hopefully this will at least get you started in a direction that will lead to success of your project.
 
I agree with Mr. B about Rnd. I'm interested in how you plan to address the Answer. If the student types an answer into a textbox, how are you or Access routines going to compare it and to what? Have you tried to parse out the meaning of strings of text?

Much easier to compare Answer a to choice a etc. from a series of possible answers.
 
I agree with Mr. B about Rnd. I'm interested in how you plan to address the Answer. If the student types an answer into a textbox, how are you or Access routines going to compare it and to what? Have you tried to parse out the meaning of strings of text?

Much easier to compare Answer a to choice a etc. from a series of possible answers.

Well, it's for an accounting class, so the answers will be integers (no alpha strings and no decimals). So, it's just a matter of comparison to the built-in value in a table. "Does this equal that?" Not a problem there.

I'm not familiar with Rnd. I appreciate the input on it and will study up. Any other ideas are welcome as well. Thanks.
 

Users who are viewing this thread

Back
Top Bottom