?
Solved

Questions And Answers Database

Posted on 2003-03-12
8
Medium Priority
?
257 Views
Last Modified: 2006-11-17
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?

 
0
Comment
Question by:BJunior
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 3

Expert Comment

by:RiverGuy
ID: 8124190
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
 
LVL 6

Expert Comment

by:TheAmigo
ID: 8124822
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
 
LVL 8

Expert Comment

by:dovholuk
ID: 8124967
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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 8

Accepted Solution

by:
dovholuk earned 200 total points
ID: 8124972
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
 
LVL 3

Expert Comment

by:RiverGuy
ID: 8128937
I never new the Rnd() function was aceesable Access as well.  Good info.
0
 
LVL 12

Expert Comment

by:nexusnation
ID: 8785625
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
 
LVL 18

Expert Comment

by:1William
ID: 8889329
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
 
LVL 6

Expert Comment

by:Mike_Metro
ID: 8896999
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question