Consulting

Results 1 to 9 of 9

Thread: Solved: Multiple option buttons on user form

  1. #1

    Solved: Multiple option buttons on user form

    Hi,

    I'm essentially doing a userform for inputting survey responses. There are 4 yes/no questions. Some people will not answer certain questions, so there are actually three responses: Y/N/No Answer. I have used option buttons for these 12 fields.

    The problem is that you can only click one field and not one per question. How do I divide these 12 option buttons so that I can get 4 responses? This has probably been asked somewhere, but I couldn't find it on VBAX or Google.

    TIA

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Set the GroupName property of like buttons.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3

    Thanks

    Thanks again for your solution. I just don't do a very good job on these searches.

  4. #4

    Does not require all answers

    The GROUPNAME worked great, making the user select one of the three choices (Yes-No-No Answer). The problem is that it does not require all 4 questions to be answered, i.e. when you input the survey, you can only select one of the three choices, but you can altogether skip a question.

    I must require one of the three answers for each of the four questions. How do I do this? I'm guessing that there is an event where I can count the number of selections made before my "command process" button is clicked where I update the worksheet with the additional data.

    TIA

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I think you have to count them

    [vba]

    Private Sub cmdOK_Click()
    If (optGroup11.Value + optGroup12.Value + optGroup13.Value) = 0 Or _
    (optGroup21.Value + optGroup22.Value + optGroup23.Value) = 0 Then

    MsgBox "incomplete"
    Else

    Me.Hide
    End If
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6

    Thanks

    Thanks again...

    I had no idea about the 0 value. I'm surprised that this will work because of the very likely possibility that the Boolean True/False has been set in the value (the usual case).

    I understand that normally a 0 or 1 means true or false, I'm just surprised that one can use this same field as a numeric.

    Thanks again.

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    When you do math on TRUE/FALSE, it resolves to a numeric value.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  8. #8

    Problem solved

    Thanks again. This is working great.

  9. #9
    VBAX Mentor
    Joined
    Oct 2007
    Posts
    372
    Location
    These aren't resolving true / false are they? They're resolving as the number of the option, right? So they're resolvign as 1 , 2 , or 3. (or 0 for nothing selected)

Posting Permissions

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