473,406 Members | 2,208 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

how to pull the correct answer from multiple choice questions database?

mb60
37 32bit
sir
In my database I have one column for question. Four columns are meant for options 1,2,3,4. The 5th column is YES/NO column.
The answers for the questions are entered into 5th column by a option box.
Now I would like to print a report with the questions and correct answers which are present in the 1,2,3,4 columns.
Example
Q) aaaaaaaaaaaaaaaaa
1) bbbbbbbb 2) cccccc 3) ddddd 4) eeeeeee
answer = 2

I would like to have the question answer in the report as given below
Q) aaaaaaaaaaaaaaaaa
answer = 2) cccccc

Thank you
Jan 25 '10 #1

✓ answered by NeoPa

Thank you.

The Choose() function would be something like line #9 :
Expand|Select|Wrap|Line Numbers
  1. SELECT [Question],
  2.        [ID],
  3.        [1],
  4.        [2],
  5.        [3],
  6.        [4],
  7.        [Answer],
  8.        [Select],
  9.        Choose([Answer],[1],[2],[3],[4]) AS AnswerText
  10.  
  11. FROM   [QuestionBank]
  12.  
  13. WHERE  [Select]

7 4203
NeoPa
32,556 Expert Mod 16PB
I understand your question, but I have no reference points included from which to give you an answer. I would suggest using the function Choose(), but I would require the SQL you have so far to provide a more helpful usage example of the function.
Jan 25 '10 #2
mb60
37 32bit
Thank you sir
where I have to place that function in the database?
I don't know anything about SQL
Jan 25 '10 #3
NeoPa
32,556 Expert Mod 16PB
And I (still) no nothing about your SQL. Please reread my last post to find out what you need to do to get more help. To clarify further, see below :
To extract the SQL from a QueryDef (saved Access query) it is only necessary to view the query in SQL View. This shows the underlying SQL for the QueryDef and is text (See Access QueryDefs Mis-save Subquery SQL for problems with SubQueries). When a QueryDef is open (either in Design View or Datasheet View) it is possible to switch to the SQL View simply by selecting View \ SQL View from the menu.

From here it is simple to Copy & Paste it to wherever you need it.
Jan 25 '10 #4
mb60
37 32bit
sir
As you directed I extracted SQL and pasting here
Expand|Select|Wrap|Line Numbers
  1. SELECT questionbank.question, questionbank.ID, questionbank.[1], questionbank.[2], questionbank.[3], questionbank.[4], questionbank.answer, questionbank.[select]
  2. FROM questionbank
  3. WHERE (((questionbank.[select])=-1));
Jan 25 '10 #5
NeoPa
32,556 Expert Mod 16PB
Thank you.

The Choose() function would be something like line #9 :
Expand|Select|Wrap|Line Numbers
  1. SELECT [Question],
  2.        [ID],
  3.        [1],
  4.        [2],
  5.        [3],
  6.        [4],
  7.        [Answer],
  8.        [Select],
  9.        Choose([Answer],[1],[2],[3],[4]) AS AnswerText
  10.  
  11. FROM   [QuestionBank]
  12.  
  13. WHERE  [Select]
Jan 25 '10 #6
mb60
37 32bit
Thank you sir
successfully I got what I want that result
I salute for your interest in solving such problems
No words to express my happiness
(pl ignore the mistakes if any, in my english)
Jan 26 '10 #7
NeoPa
32,556 Expert Mod 16PB
Very pleased to hear it.

We do try to ignore language problems, but sometimes it's hard to understand. This thread was no problem though.
Jan 26 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: raiya | last post by:
hi, I'm a teacher and new ms access user. I'm intending to design an ms access db to post multiple choice questions each with 4 choices. I created 2 tables one for the questions and the other for the...
1
by: carly | last post by:
hi, i've been solving these multiple choice questions, and i'd like to know if what i answered is right ot wrong......... just to double check :) I) Consider the code given below. ...
0
by: Night Air | last post by:
I have problem with a website that collects user responses to multiple choice questions. The users choose and value from a Radio Button, then click on a Next button to go the next page. The...
1
by: Brian Byrne | last post by:
Hi , Does anybody know where there is a good bank of C++ multiple choice questions covering all the essentials. I need to brush up on the basics and multiple choice is the ideal way !? ...
1
by: Night Air | last post by:
I'm working with a website that presents a series of multiple choice questions to users. The problem at hand is that the pages with the questions take some time load and the users are under a...
3
mb60
by: mb60 | last post by:
hello I am working as teacher. Pl any one can help me in creating a template for multiple choice questions, and matching questions and selecting the answers in ms access? The format of qns as...
3
by: shashkun | last post by:
hii i wanted to insert questions, options and correct answer in the database(Multiple choice questions). I have around 8000 questions to be inserted. I tried with copying entire content from word...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.