Results 1 to 11 of 11
  1. #1
    Join Date
    Oct 2002
    Location
    Charlotte, NC
    Posts
    45

    Lightbulb Unanswered: Printing an Answer Sheet

    I have created a database to store a test I give my students. It contains a column for QUESTION, CORRECT ANSWER, and INCORRECT ANSWER 1, INCORRECT ANSWER 2, ... and so on.

    I have created a report to print out theses questions in the normal test format:
    ex:

    1) What is the capital of North Carolina?
    A) Tahoe
    B) Raleigh
    C) Durham
    D) Lincolnton

    2) What is the capital of Georgia?
    A) Munson
    B) Winston
    C) Atlanta
    D) Bismark
    and so on.

    the correct answer is stored under a variable called "Cor_Ans".. so in my example above.. Cor_Ans would equal B for question 1. Cor_Ans would equal C for question 2.

    My Question - how can I attach an answer sheet at the end of the report? I want the report to list all the questions (then pagebreak) Then list the answers...

    ex:
    1) B
    2) C
    3) D
    ... and so on

    Do I use a subreport? I have tried this.. by placing the subreport in my main report's "Report Footer" - but it doesn't get the values of "Cor_Ans" passed to it.. nor does it cycle along with the main report.

    Please ask any questions.. any advice would be appreciated.

    brian
    -----

    "How much deeper would the ocean be without sponges?"

  2. #2
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    thats one test i would have failed, but then i don't suppose you'd do to well on a test over the counties in Engand Either

    puting it in the footer wont work as it's only the body that roled, the simplest answer is to create 2 reports, 'test' and 'answers' and combine the print functions for both to sit in a form button.

    ie
    Private Sub Print_Report_Click()
    DoCmd.OpenReport "test", acNormal
    DoCmd.OpenReport "answers", acNormal
    End Sub
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  3. #3
    Join Date
    Oct 2002
    Location
    Charlotte, NC
    Posts
    45

    Question about my random generator

    In my report, I have a random generator that places the correct answer in a different location (A,B,C, or D) each time the report is ran (That way.. I can give different tests to different students.. and they can't cheat off each other).

    If I created two different reports.. the Answer_Sheet report wouldn't know the correct answer until the Question report was ran.

    Is there a way I can pass the values over during runtime?

    brian

    PS: I would fail a test of British counties. lol
    -----

    "How much deeper would the ocean be without sponges?"

  4. #4
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820

    Re: Question about my random generator

    simple answer: Yes

    Detailed answer:
    add the following code
    Code:
    Sub append(PaperID As String, QuestionNumber as integer, _
    AnswerLetter As String)
        'note if paperID is numeric remove the single quote around the paperID in SQL
        appendSql= "INSERT INTO CorrectAnswers(PaperCode,QuestionNum, " & _ 
    "AnswerLocation) SELECT '" & PaperID & "'," & QuestionNum & " ,'" & _
    AnswerLetter & "'"
        DoCmd.RunSQL appendSql
    End Sub
    this will append the results into a table called Crrectanswers which has 2 fields one the paper code (i'm assuming that you name each random paper some how so that you can match the answer sheet to the question sheet), two the quetion number and finally the letter the correct answer is placed at,

    it's called in the following manor
    <random Gen code>
    append <PaperID>,<questionNumber> ,<correctLoc>

    i'm sure any of your student reading this site will pleased to know how much you trust them not to cheat, :-)

    Originally posted by stratego16
    In my report, I have a random generator that places the correct answer in a different location (A,B,C, or D) each time the report is ran (That way.. I can give different tests to different students.. and they can't cheat off each other).

    If I created two different reports.. the Answer_Sheet report wouldn't know the correct answer until the Question report was ran.

    Is there a way I can pass the values over during runtime?

    brian

    PS: I would fail a test of British counties. lol
    Last edited by m.timoney; 12-05-02 at 07:34.
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  5. #5
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    this will create a table in the format
    paper 1, 1, A
    paper 1, 2, B
    paper 1, 3, A
    paper 1, 4, D
    paper 1, 5, D
    paper 1, 6, C
    paper 1, 7, A
    paper 1, 8, B
    paper 1, 9, D

    you then just base the answer sheet on this, you may use the sql
    TRANSFORM CorrectAnswers.AnswerLocation AS FirstOfField3
    SELECT CorrectAnswers.PaperCode
    FROM CorrectAnswers
    GROUP BY CorrectAnswers.PaperCode
    PIVOT CorrectAnswers.QuestionNum;

    to do a cross tab on this and get
    Last edited by m.timoney; 12-05-02 at 08:01.
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  6. #6
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    sorry forgot to attach the pic
    Attached Thumbnails Attached Thumbnails temp.gif  
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  7. #7
    Join Date
    Oct 2002
    Location
    Charlotte, NC
    Posts
    45

    Cool Thanks for your Help

    Thank you for your help m.timoney

    I am a little new at this so it might take me a few days to put it all together.

    Ah, the untrusting teacher - I've been there.. and seen it all. It's time the teacher has the last laugh! (hahaahah) *evil laugh*

    For extra credit.. I'm throwing in a question on counties in England.

    thanks again,
    brian
    -----

    "How much deeper would the ocean be without sponges?"

  8. #8
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    give them double credit if they can say the names correctly
    ie i'm from Leicestershire prononced Lester'sheer
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  9. #9
    Join Date
    Oct 2002
    Location
    Charlotte, NC
    Posts
    45

    Red face New Question

    M.timoney or anyone,

    Is there an easy way to specify how many questions I want to select from my database?

    Suppose I create a form where I can enter "17" if I want a 17 question test.

    Brian
    -----

    "How much deeper would the ocean be without sponges?"

  10. #10
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    thats an easy one, just have a box ( txt, combo, list, etc) and use the value in it to run a for loop, affraid i can't really go any deep in to this with out more data on the structure of you database
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  11. #11
    Join Date
    Oct 2002
    Location
    Charlotte, NC
    Posts
    45

    Question Structure

    Well I suppose the structure is "simple" since I have created it. Nothing Advance.

    I have a form which I can select a test name (linked to the specified database) and I can enter the amount of questions I would like. I press continue and it displays two reports (1: all questions to the specified test (which is what I am trying to fix) and 2: all the answers to the displayed report).

    The report has about 100 lines of code I have created to perform certain tasks (all in the "Sub Question_Detail_Format" section)

    Do I place the FOR loop at the beginning of this Question_Detail_Format section? And after it cycles the specified times.. tell it to QUIT?

    I guess what I am saying is that I don't grasp how Access cycles in reports. I should change my user name to NEWBE.

    Any help would be appreciated.
    -----

    "How much deeper would the ocean be without sponges?"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •