Results 1 to 2 of 2
  1. #1
    Join Date
    May 2013

    Smile Unanswered: Option Group Code

    I am working on using a option group as a yes/no option. I need to know how to get a field below to populate when the yes side of the group is selected. The field that populates cannot be seen unless "yes" is selected. I would appreciate any help with this function. The Option grouping is new to me. I am using Access 2013 and there isn't much support for this. Thank you ahead of time for your assistance.

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 15
    1. Use the toolbox to put an option group control on the form.
    2. Add 2 controls (Toggle buttons, option buttons or check boxes) by dragging them from the toolbox to somewhere inside the option group control.
    3. Allocate a value to the Option value property of these 2 controls. Since the choices will be Yes and No, choose the value 0 (zero) for the No control and -1 for the Yes control (in VBA 0 = False and -1 = True).
    4. Use the Default value property of the option group control to set the default value of the system (either 0/No/False or -1/Yes/True).
    5. From now on, you only deal with the option group control.
    - If it is bound to a column (in a bound form), i.e. if the value must change accordingly to the contents of a column and if the contents of a column must change when you change the value in the option group, use the Control source property of the option group control to bind it to its related column.
    - If it's unbound, you can use the AfterUpdate event of the option group control to handle the change, something like:
    Private Sub FrameYesNo_AfterUpdate()
        If Me.FrameYesNo.Value = True Then
            ' Do something when the Yes option is selected.
            ' Do something when the No option is selected.
        End If
    End Sub
    Have a nice day!

Posting Permissions

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