How do I code an option to deselect if another is selected?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lautoka

    #1

    How do I code an option to deselect if another is selected?

    Hi I'm trying to create a simple interface for data entry. Everything else is working fine but I'm having trouble with one thing.

    A question must have an answer, either "Yes" or "No", but not both. I want to use a control button for this but if I amend the properties to be a "Yes/No" response, then I only see an option to select or deselect - not two options. I have tried to create two and code it to create a rule whereby selecting "Yes" deselects "No" and vice versa...but "No" always stays selected.

    Further to this, if "Yes" is selected then the user will be asked for more information.

    Help!
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32669

    #2
    You should probably be looking at AfterUpdate events for both controls. Controls could be either CheckBoxes or RadioButtons. The code in both event procedures should set the value of the other control to Not itself, then go on to enable/disable (or lock/unlock, or even hide/show) the controls where further information is entered.

    Does this make sense?

    Comment

    • lautoka

      #3
      Thanks! It made sense but I kept on getting error messages and just went with an "Option Box" in the end. Now I have the issue of what to do when the "Yes" option has the "On got focus" status. I'll keep playing around, I'm sure (/hope) something will work out. Thank you for your help!

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        When using RadioButtons an OptionGroup is most commonly used. The nice thing about this is that the RadioButton states are all managed by the OptionGroup control whenever one is selected. It also means you needn't handle the RadioButton events themselves, but can use the AfterUpdate() event procedure of the OptionGroup instead. Does that point you along the right lines? We can help more if you get stuck.

        Comment

        Working...