vba to fill form's OptionGroup's Value RRS feed

  • Question

  • Hi,

    I built up a form in which there're a OptionGroup control (grpTPractice).  I intend to fill it from recordset.  My table records the values as at table's column (TPracticeCode).

    How do I make a particular OptionGroup's value enabled with the value from recordset in VBA.  For example, if the value is "3" at TPracticeCode,  the option button for "Private Group Practice" is enabled, the value is "8", the option button for "Others (Specify)" is enabled.

    Thank you in advance.


    Saturday, March 11, 2017 12:41 AM


  • Hi,

    Not sure I understand the logic here. How come TPracticeCode = 3 is equal to grpTPractice = 8 (Private Group Practice)?

    If you set up the Option Group properly, the values for each option should match the value it represents in TPracticeCode. In other words, if TPracticeCode = 3, then Private Group Practice in grpTPractice should also be equal to 3.

    If the above was just a typo, then here's how you'd assign the value to the Option Group from a Recordset.

    Me.grpTPractice = rs!TPracticeCode

    Hope it helps...

    • Marked as answer by NT100 Saturday, March 11, 2017 2:55 AM
    Saturday, March 11, 2017 1:17 AM