Random posts (1 Viewer)

kentendresen

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

I have a database where the user go through multliple choice questions, one question on each form. And the user can go through all the questions in the database.

But I want to make a random 30 question test. Is that possible? Is it possible to program the database to pick out 30 random questions from the database and get it in the forms?

BR,

Kent Endresen
 

Mile-O

Back once again...
Local time
Today, 00:42
Joined
Dec 10, 2002
Messages
11,316
I posted a random number generator piece of code here and, with a play about, you might find something helpful.
 

kentendresen

Registered User.
Local time
Today, 01:42
Joined
Nov 13, 2002
Messages
49
Thank you Mile-O-Phile!

I guess that code will work eventually. But I am not so in to vb, so I need some more help:

Where shall I put in the code? I don't want to randomize the main table, only when the user takes the test in the form. The ID on all the records is sorted by Autonumber, does that affect the code?

Rookie Kent
 

Mile-O

Back once again...
Local time
Today, 00:42
Joined
Dec 10, 2002
Messages
11,316
Are you wanting to select a random number of questions from a pot?

If so, you say you want to ask 30 questions but how many questions are in the pot?

Or, is there a total of 30 questions and you just want to ask them in a random order for every person taking the test?
 

kentendresen

Registered User.
Local time
Today, 01:42
Joined
Nov 13, 2002
Messages
49
It is much more than 30 questions in the pot, I want to ask 30 of them, randomly for each time, so that the user who takes the test will get other questions the second time.

The excact number of questions in the pot will differ, because the administrator can go in and add some more questions in the database. It will be around 150-200 questions in the database.
 
Last edited:

Mile-O

Back once again...
Local time
Today, 00:42
Joined
Dec 10, 2002
Messages
11,316
Okay, I'll try and modify the code for you and post back later.
 

kentendresen

Registered User.
Local time
Today, 01:42
Joined
Nov 13, 2002
Messages
49
I've attached a screenshot of the form, just to give you an idea of how it works.

Some of the words are in Norwegian, but here is a brief explanation:

The question is the first field, then comes the four alternatives. (multiple choice)

Then a button to go on to the next question.
 

Attachments

  • screenshot.jpg
    screenshot.jpg
    69.7 KB · Views: 677
Last edited:

Mile-O

Back once again...
Local time
Today, 00:42
Joined
Dec 10, 2002
Messages
11,316
Okay Kent, here's a sample database to look at instead.

It's got eight components:

tblQuestions;
tblRandom;
qryScoring;
frmMainMenu;
frmTest;
frmScore;
autoexec;
basRandomSelection

The first table, tblQuestions, includes a list of all questions that the database can ask including multiple choice answers. I've only put fifty questions in here asking about capital cities of the world.

tblRandom is emptied every time you take the quiz and populated with a set of thirty questions chosen at random from the pot of 50.

qryScoring is used to mark the person taking the test's answers

frmMainMenu includes two buttons and is the first thing you'll see

frmTest runs the actual test working off the random questions generated

frmScore informs the user of their score in 25/30 mode and as a percentage and allows them to take the quiz again

autoexec is self explanatory as it just runs the database

and basRandomSelection includes the two subroutines that I pointed you to earlier regarding selecting the questions and then populating a table with those questions

Every time the test is run, the questions chosen will be different

Hope this helps...
 

Attachments

  • dbmultiplechoicetest.zip
    29.9 KB · Views: 903

Mile-O

Back once again...
Local time
Today, 00:42
Joined
Dec 10, 2002
Messages
11,316
Your welcome, any questions just give me a shout...
 

kentendresen

Registered User.
Local time
Today, 01:42
Joined
Nov 13, 2002
Messages
49
Ok, I've changed the design on the forms so they are much the same as the other forms in my database.

I want to implement your test in my database now. I have two tables. One for Open Book Questions and one for Closed Book Questions. They are equal, just with different questions.

The tables contain QuestionID, Question, AnswerA/B/C/D, ActualAnswer and References, but written in Norwegian. So I guess it will not be to hard to implement? Any tricks?

Just give me some good hints, and I'll try to make it work.
 

Mile-O

Back once again...
Local time
Today, 00:42
Joined
Dec 10, 2002
Messages
11,316
You could combine the two tables with a Yes/No Field to mark whether questions are Open or Closed and have two queries that determine your open and closed book questions and use them as the pot for the different quizzes.

As, in my example, the scoring table was temporary, you could also write an append query from the scoring to store the results of everyone in the test for future reporting.

You might also want to add a feature through querying the score table to tell the person taking the test which questions they got wrong.

Have fun...
 

kentendresen

Registered User.
Local time
Today, 01:42
Joined
Nov 13, 2002
Messages
49
It is working now, thank you!

Will it be hard to modify this test so it can be used on all the questions in the database? I want a test where the user can go through all the questions.

I guess it will be much the same, but how do I modify the number of records? In the code for the progress-button the Intprogress is set to 30. Can this be made dynamic so that it counts all the records in the table before the test starts?

Is it possible to use an if-sentence, something like:

If IsNull (Question) Then
MsgBox "This was the last question in the database"
"Press OK to se the score"

Just an idea!
 
Last edited:

gastoman

Registered User.
Local time
Today, 00:42
Joined
Apr 19, 2004
Messages
14
Help

Hi,

Ok I know this is a really old post but for me it’s quite actual.


I’ve been playing around with the database that Mile-O-Phile made (original database added as link).

I’m trying to expand the database by adding a multiple language feature as well as the possibility to choose from several of topics. So I want to choose a topic and a language to take a test in.
I only need 20 questions and 3 multiple choice answers.

Can anybody point me in the right direction or help me with a sample database that can do this.

Thanks,

Martijn
 

Attachments

  • dbmultiplechoicetest.zip
    29.9 KB · Views: 339

Insidious

New member
Local time
Yesterday, 16:42
Joined
Aug 22, 2009
Messages
1
Okay Kent, here's a sample database to look at instead.

It's got eight components:

tblQuestions;
tblRandom;
qryScoring;
frmMainMenu;
frmTest;
frmScore;
autoexec;
basRandomSelection

The first table, tblQuestions, includes a list of all questions that the database can ask including multiple choice answers. I've only put fifty questions in here asking about capital cities of the world.

tblRandom is emptied every time you take the quiz and populated with a set of thirty questions chosen at random from the pot of 50.

qryScoring is used to mark the person taking the test's answers

frmMainMenu includes two buttons and is the first thing you'll see

frmTest runs the actual test working off the random questions generated

frmScore informs the user of their score in 25/30 mode and as a percentage and allows them to take the quiz again

autoexec is self explanatory as it just runs the database

and basRandomSelection includes the two subroutines that I pointed you to earlier regarding selecting the questions and then populating a table with those questions

Every time the test is run, the questions chosen will be different

Hope this helps...



hi greetings.. i was trying to open your sample codes and it really fits on what i am looking for.


but i'm having a hard time converting the codes given to vb.net2005(which is what i'm using now).. i badly need it. can you help me? please. thanks in advanced.
 

johnwatkins35

Registered User.
Local time
Yesterday, 16:42
Joined
May 16, 2012
Messages
20
Mile - O,
I downloaded your database. But i cant open it. can you create it in a newer version of access, please. Im interested in taking a look at your database.
 

Users who are viewing this thread

Top Bottom