Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2002
    Posts
    20

    Question Unanswered: Weighting System VBA

    I have a table that contains the results of a questionaire.

    Question one (radio buttons) can be a,b,c or d. This one is easy and i have done.
    Question two (radio buttons) can be a,b or c. Again done.
    Question three (check boxes) can be a thru h and any combination. inbetween. values are comma separated.
    Question four (check boxes) can be 1 thru 15 and any combination inbetween. values are inserted and comma separated.

    Here is my question. How to I write code to weight them?
    Question three: a=5, b=4, c=2, d=3, e=1, f=4, g=1, h=-5
    Question four: 1=0, 2=1, 3=0, 4=0, 5=1, 6=0, 7=1, 8=1, 9=1, 10=0, 11=1, 12=0, 13=0, 14=0, 15=1

    I have a table Questionaire with the following columns:
    [appid] [q_one] [q_two] [q_three] [q_four] [q_one_score] [q_two_score] [q_three_score] [q_four_score] [total_score]

    Thanx in advance.

  2. #2
    Join Date
    Apr 2002
    Posts
    139
    My first idea would be to use the Select Case statement in VBA.
    Check out Access Help for detail code sample.

    hth

  3. #3
    Join Date
    Jul 2002
    Posts
    20
    Well the problem more is the format of the data in the tables

    like in the questionaire table
    appid = 201
    question_three = 1,2,3,4,5,6,7

    so I need to write a parsing function, store the values in an array, and then i can create a weighting routine and write it into the score column

  4. #4
    Join Date
    Jul 2002
    Posts
    20

    Question

    anyone?

  5. #5
    Join Date
    May 2002
    Location
    Atlanta, GA
    Posts
    117
    Hey nrage,
    I think I understand you. You want to show number values for different items checked on a form. Yes???? Then add them all up????

    If so, then try using invisible fields beside the check boxes that default to zero on load then use the After_Update event of the check box to update the number accordingly.

    Private Sub After_Update()
    If Me.Check1 = True Then
    Me.Check1Text = 1
    End if
    If Me.Check1 = False Then
    Me.Check1Text = 0
    End if
    End Sub

    When finished just add up the fields. If there were 10 check boxes that all defaulted to zero on load and the user selects three of them then there score will be three. If I am way off please let me know, and we can try again.

    Later, Kal

  6. #6
    Join Date
    Apr 2002
    Posts
    139
    Hi,

    Think I understand your problem now. This works fine with me:

    Dim Question3 As Integer

    Question3 = IIf(chkBox3a, 5, 0) + IIf(chkBox3b, 4, 0) + IIf(chkBox3c, 2, 0) + IIf(chkBox3d, 3, 0) + IIf(chkBox3e, 1, 0) + IIf(chkBox3g, 1, 0) + IIf(chkBox3h, -5, 0)

    MsgBox Question3

    hth

  7. #7
    Join Date
    Jul 2002
    Posts
    20

    Arrow

    Actually, the check boxes were on a form in an html web page. I grabbed all the values from the form and what I am left with is an answer to one question showing all the boxes checked. Poor design I guess, but there is no turning back now

    For question 4 I have results in a table like this for example:
    [app_id] = 201
    [question_four] = 1,2,3,5,7,11

    all I want to do i be able to split the answers to question four up to another table like this:
    [app_id] = 201
    [question_id] = 4
    [response] = 1

    [app_id] = 201
    [question_id] = 4
    [response] = 2

    [app_id] = 201
    [question_id] = 4
    [response] = 3

    [app_id] = 201
    [question_id] = 4
    [response] = 5

    And so on. I just do not know how to handle the parsing like that. I can separate Blow, Joe... but this i know not.

    Thanx in advance.

Posting Permissions

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