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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mb60
    New Member
    • Aug 2008
    • 37

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

    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) aaaaaaaaaaaaaaa aa
    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) aaaaaaaaaaaaaaa aa
    answer = 2) cccccc

    Thank you
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32656

    #2
    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.

    Comment

    • mb60
      New Member
      • Aug 2008
      • 37

      #3
      Thank you sir
      where I have to place that function in the database?
      I don't know anything about SQL

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32656

        #4
        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.

        Comment

        • mb60
          New Member
          • Aug 2008
          • 37

          #5
          sir
          As you directed I extracted SQL and pasting here
          Code:
          SELECT questionbank.question, questionbank.ID, questionbank.[1], questionbank.[2], questionbank.[3], questionbank.[4], questionbank.answer, questionbank.[select]
          FROM questionbank
          WHERE (((questionbank.[select])=-1));
          Last edited by NeoPa; Jan 25 '10, 08:23 PM. Reason: Please use the [CODE] tags provided

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32656

            #6
            Thank you.

            The Choose() function would be something like line #9 :
            Code:
            SELECT [Question],
                   [ID],
                   [1],
                   [2],
                   [3],
                   [4],
                   [Answer],
                   [Select],
                   Choose([Answer],[1],[2],[3],[4]) AS AnswerText
            
            FROM   [QuestionBank]
            
            WHERE  [Select]

            Comment

            • mb60
              New Member
              • Aug 2008
              • 37

              #7
              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)

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32656

                #8
                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.

                Comment

                Working...