Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2002
    Posts
    4

    Question Unanswered: Option Group Problem

    I have an option group with 3 options. The default for the option group is set to 'False'. Once one of the options has been clicked there is no way to return all of the values to False again. I know I could add a fourth button and call it none or reset or some such, but for the purposes of this project I'd rather not. Is there a way to programatically reset the value of all three option buttons to False?

    Thanks!

  2. #2
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    91

    Re: Option Group Problem

    How about reset all option group when the radio button that has been selected is clicked again? Just put the code on the radio button _click, check the current value, then reset if that radio button is already selected before.

    Hm... do you ask about how to reset the opt group? How if you just setting the option group to Null?
    Last edited by Djoko; 09-24-02 at 23:04.

  3. #3
    Join Date
    Sep 2002
    Posts
    4
    for the whole option group there's an 'on click' event, but no on click event for the individual buttons. To be more explicit with the problem, I have one column to work with in the underlying table. There are three mutually exclusive yes no questions. You may have 3 no's but only one yes:

    question1 yes no
    question2 yes no
    question3 yes no

    I've been able to get three no's, and for the correct no button to deactivate when a yes button is clicked . . . unless you try to go back to all no's after you've clicked one of the yes buttons. I know I could do it with a 4th option of none, but dogone it, it seems like you ought to be able to reset the option group to null!

  4. #4
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    91
    Originally posted by cyn
    for the whole option group there's an 'on click' event, but no on click event for the individual buttons.
    You can use OnMouseDown event on each Option Button. So if your OptionGroup will return 1, 2 or 3, on each Option Button just put something similar like this:

    Code:
    Private Sub OptionButton1_MouseDown(Button As Integer, Shift As Integer, _
        X As Single, Y As Single)
      If Me.OptionGroup = 1 Then Me.OptionGroup = Null
    End Sub
    
    Private Sub OptionButton2_MouseDown(Button As Integer, Shift As Integer, _
        X As Single, Y As Single)
      If Me.OptionGroup = 2 Then Me.OptionGroup = Null
    End Sub
    
    ...
    Do you manually deactivate the correct no button to when a yes button is clicked...?
    Do you create it using control wizard, I think that is easier...?
    By the way, you can use this mouse down event to replace onClick.

  5. #5
    Join Date
    Sep 2002
    Posts
    4
    now that just might work! I'll try it tonight when i get home to see. Thanks!

    To answer your question regarding the option group. Only the yes answers are in the option group. The no answers are actually unbound and are checked or unchecked by an If . . . Then . . . ElseIf statement attached to the option group's on click event.

    I'll let you know if your code works, and thanks again! . . this seemed so simple to begin with, 8D

  6. #6
    Join Date
    Sep 2002
    Posts
    4
    You were SO close to perfectly right, and you gave me the piece of the puzzle i was missing! Thanks!

    Your code would still allow a yes and no answer, but you COULD undo it by clicking again on the yes. You gave me the idea though to use the on click function of the NO boxes and refer to the OptionGroup itself rather than the indiviual controls in the option group.
    *****
    Private Sub Q1aNo_Click()
    If Me.RelatedTo = 1 Then
    Me.RelatedTo = Null
    End If
    End Sub

    Private Sub Q1bNo_Click()
    If Me.RelatedTo = 2 Then
    Me.RelatedTo = Null
    End If
    End Sub

    ********

    woohoo! . . no on to the bazillion other pieces of this puzzle!

Posting Permissions

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