Questions And Answers Database

Hi,

I am trying to design a Access database that can choose random questions from a table and randomly place the answers in no particular order.

Questions   Answers   Category  Section
---------   -------   --------  -------
Q_ID        A_ID      C_ID      S_ID
Q_Ctgy      A_QNo     C_Name    S_NumQs
Q_Code      A_Answer
Q_Question  A_Right
Q_Image
Q_Section

Note: Q_Ctgy links up with C_ID,
A_QNo links up with Q_ID.
Q_Section links up with S_ID.


For example, I have 4 sections. In each section (S_ID), a number of questions that are selected at random for each section (S_NumQs).

These questions must be random as per each section.

Each of the answers to each question must be at random also.

Is there a way to select random questions from the table and randomly place answers within the form?

 
BJuniorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RiverGuyCommented:
I don't think there is in Access like there is in SQL Server.  I would do this in VBA.  I would read the records into arrays, size the arrays to the count of the records, and then choose some random elements, finally displaying them on the form.
0
TheAmigoCommented:
Sounds like there should be an easy way, but I just tried:
SELECT *
FROM Answers
ORDER BY Rnd();
and all rows get the same value for Rnd()... oh well.
0
dovholukCommented:
there is an "easy" way... all you need to do is this.

first, get the name of one of the fields in the table Answers. i'll pretend there's a field called QuestionNumber...

then just use this:

SELECT
     *
FROM
     Table1
ORDER BY
     Rnd(nz([QuestionNumber],0));


that way you'll be giving the RND() method a NEW SEED everytime you call it, that will force RND() to return a different random value each time...

give it a go, it should do what you want...

dovholuk
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

dovholukCommented:
of course that's supposed to be:

SELECT
    *
FROM
    Answers
ORDER BY
    Rnd(nz([QuestionNumber],0));


used table1 not answers in my post... dolt...

dovholuk
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RiverGuyCommented:
I never new the Rnd() function was aceesable Access as well.  Good info.
0
nexusnationCommented:
Hi BJunior,
This question has been abandoned and needs to be finalized (102 days since last comment).

   You can accept an answer, split the points, or get a refund. Go to
   http://www.cityofangels.com/Experts/Closing.htm for information and options.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

nexusnation
EE Cleanup Volunteer for Microsoft Access
0
1WilliamCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept question, points to dovholuk
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

1William
EE Cleanup Volunteer
0
Mike_MetroCommented:
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.