Selecting multiple check boxes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LuCnt
    New Member
    • Feb 2007
    • 3

    #1

    Selecting multiple check boxes

    I am using Visual basic 6 and i want to be able to select more that one response in a option group with check boxes. As it is now i can only select one response at a time. the code looks like this. The option group is fractivities

    Code:
    Private Sub FrActivities_Click()
    If Me.FrActivities.Value = 1 Then
      Cusactivities = " Running "
    End If
    If Me.FrActivities.Value = 2 Then
      Cusactivities = " Walking "
    End If
    If Me.FrActivities.Value = 3 Then
      Cusactivities = " Biking "
    End If
    If Me.FrActivities.Value = 4 Then
      Cusactivities = " Swimming "
    End If
    If Me.FrActivities.Value = 5 Then
      Cusactivities = " Skiing "
    End If
    If Me.FrActivities.Value = 6 Then
      Cusactivities = " In Line Skating "
    End If
    
    End Sub
    thanks
    Last edited by Killer42; Feb 13 '07, 06:00 AM. Reason: Please include CODE tags
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Are you sure this is VB6? I thought options groups only worked like that in VBA. How do you create an option group in VB6?

    Anyway, if you just create an empty frame then place your checkboxes in it, you can examine the .Value property of the individual checkboxes to see whether they are checked or not, rather than dealing with the "value" of the option group.

    Comment

    • LuCnt
      New Member
      • Feb 2007
      • 3

      #3
      my apologies, its VBA. I will try what you suggested.
      Thank you very much for your time.

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by LuCnt
        my apologies, its VBA. I will try what you suggested.
        Thank you very much for your time.
        Fair enough. In VBA, you might find that to do it that way you need to skip the frame and place the checkboxes directly on the form. (Not sure, though - let us know how it goes.)

        Comment

        Working...