Generating Multiple Choice Tests

K

karst

I currently use Access 2003 to create tests. I am looking to use a grouping
and random sampling method to improve efficiency. In as much that I use
access to create tests now, is VBA an appropriate platform for randomizing
and group sampling or should I go to an independent language. Any advice
will be greatly appreciated.
 
G

Gina Whipp

karst,

******UNTESTED...

Something like...

SELECT TOP 1 Rnd([TestID]) AS Expr1, TestText
FROM tblTests
ORDER BY Rnd([TestID])

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

I currently use Access 2003 to create tests. I am looking to use a grouping
and random sampling method to improve efficiency. In as much that I use
access to create tests now, is VBA an appropriate platform for randomizing
and group sampling or should I go to an independent language. Any advice
will be greatly appreciated.
 
J

John W. Vinson

I currently use Access 2003 to create tests. I am looking to use a grouping
and random sampling method to improve efficiency. In as much that I use
access to create tests now, is VBA an appropriate platform for randomizing
and group sampling or should I go to an independent language. Any advice
will be greatly appreciated.

You can get a pseudorandom subset of the records in a table using the Top
Values property of a query, with help from a little VBA. Put this little
function into a Module:

Public Function RndNum(vIgnore As Variant) As Double
Static bRnd As Boolean
If Not bRnd Then
'Initialize the random number generator once only
bRnd = True
Randomize
End If
RndNum = Rnd()
End Function

Then add a calculated field to your Query by typing

Shuffle: RndNum([fieldname])

in a vacant Field cell, where [fieldname] is any field in
your table - this forces Access to give a different random
number for each record.

Sort the query by Shuffle, and set its Top Values property
to the number of records you want to see.
 
K

karst

Thank you so much for your help - I will experiment with this to modify my
current generator.
--
mhm


John W. Vinson said:
I currently use Access 2003 to create tests. I am looking to use a grouping
and random sampling method to improve efficiency. In as much that I use
access to create tests now, is VBA an appropriate platform for randomizing
and group sampling or should I go to an independent language. Any advice
will be greatly appreciated.

You can get a pseudorandom subset of the records in a table using the Top
Values property of a query, with help from a little VBA. Put this little
function into a Module:

Public Function RndNum(vIgnore As Variant) As Double
Static bRnd As Boolean
If Not bRnd Then
'Initialize the random number generator once only
bRnd = True
Randomize
End If
RndNum = Rnd()
End Function

Then add a calculated field to your Query by typing

Shuffle: RndNum([fieldname])

in a vacant Field cell, where [fieldname] is any field in
your table - this forces Access to give a different random
number for each record.

Sort the query by Shuffle, and set its Top Values property
to the number of records you want to see.
 
K

karst

Thank you fjor all your help - I will begin to incorporate information from
both these replies.
 

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