Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2008
    Posts
    59

    Unanswered: Creating Interactive Question Forms

    Hi,
    I am trying to create a way in which new question forms can easily be entered by the user and then filled out for different clients afterwards. I have created a form so that the user can add questions. The problem I having is with the type of questions. There are different ways in which questions can be answered. For example, yes/no, rating, text, etc. I have created a combo box in this form so that the user can choose how each question is answered.

    I have then created a second form which displays all the questions. This is related to the clients unique id so that each client should have one of these forms filled out. I am trying to set it so that each question will display in the correct manner. To do this I have created this coding:

    Code:
    Private Sub Form_Current()
    If Me.question_type = "Blank" Then
       Check.Visible = True
       OptionBox.Visible = False
       TextBox.Visible = False
       
    ElseIf Me.question_type = "Rating" Then
       Check.Visible = False
       OptionBox.Visible = True
       TextBox.Visible = False
    
    Else
       Check.Visible = False
       OptionBox.Visible = False
       TextBox.Visible = True
       
    End If
    End Sub
    I want to show all questions on one individual form and this is causing problems as now when any question is highlighted, if for example it is a check box question, then all questions with then have a check box next to them and will show the same answer as the highlighted question.

    Is there an alterative way I can do this or a way of amending the code so that once a question is filled in the answer is retained and visible and so that each question has the correct item next to it (check, option, text, etc.)?

    Any help on this at all would be massively appreciated!!

    Thanks,
    Russ

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    The questions are on a continuous subform,... right?

    That behaviour is typical of a subform, whichever record has the focus determines which "settings you see". There is no way I am aware of to correct this issue.

    What you could do is concatenate the answer into one field. If it is a rating, show the number. If it is a tickbox, show Yes/True or No/False, if it's text, show the text. Then you don't have to morph the controls at all. This is what I would do.

    The only other alternative I can think of is to have a singleform, with, say, 10 questions on it, along with next/previous navigation buttons. A much harder exercise.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Somewhere in a thread called "Snippets", I have a complete "Question" survey type database designed. It has some great examples on how to easily create a question/answer table along with defining custom data types as well as how to portray these fields on a form. You'll have to search for the "snippets" post as I'm not sure where it currently is in this forum. The db was called the "Survey" example.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Here's the "Survey" example you may want to look at: http://www.dbforums.com/6330698-post67.html
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  5. #5
    Join Date
    Nov 2008
    Posts
    59
    Hey pkstormy,
    Thanks so much for showing me that example. I think it could be really useful for me.

    There is one major difference though with the database I am creating. The surveys for my database are liable to change on a regular basis, sometimes questions might change for example, or new surveys will need to be created. I am therefore trying to create a database where the client can add or amend surveys whenever there is a need to.

    Therefore I was hoping to have each question on a particular survey to use information from a table. Can you think of anyway that this might be possible? I think the way that I was trying to do this was very complicated.

    Thanks,
    Russ

  6. #6
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Yep. I know exactly where you're coming from. Actually you can have the users enter their questions and define their answer type in the example.I'm working on a more "generically" named table structure at work right now as this survey example was poorly named with tables named specifically to the program. Try looking at the table: dbo_LILookupSurveyQuestionsFieldStaff and then at the form called: LISurveyFieldStaffAllParts. Again, the naming is more specific to the program but I believe this functions like you want to. Since I designed this years ago, I had my old work place send me this and since the data's on SQL Server, unfortunately there's no data to show how it works (which I should've entered before uploading.) Try entering data into the above mentioned table and then opening the above form. I should be finished with the one I'm working on (where I named the questions table: tblQuestions) next month and I'll upload it. Again, I did the example about 10 years ago so bear with a few things.
    Last edited by pkstormy; 04-01-09 at 20:15.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

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