THE Option Button in the toolbox How i can use it?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, is there is such a code to verify is an option button is
selected??
& what is the option group?
& if there is such a code where i wriet it? I mean in which event

thanks for any help
 
Hi, is there is such a code to verify is an option button is
selected??
& what is the option group?
& if there is such a code where i wriet it? I mean in which event

thanks for any help


An "Option Box" or "Option Group" control is a box containing several
other controls (which might be checkboxes, option buttons, or toggle
switches). Each such control has an associated number - it might be
three checkboxes numbered 1, 2 and 3 for example.

The Value property of the Option Group control is whichever value the
user selected - if they check the checkbox numbered 3, the value of
the Option Group control will then be 3.

You can put code in the Option Group's AfterUpdate event to detect
that the user has made a selection.

John W. Vinson[MVP]
 
hi John

thank you for reply I did understand you verey well, but now my qustion to
you is

when i selecet an Option Button it's number was 16 and the othere was 19
...... be with me in that!!!! ok frist! Is there is worng in that?
2- Do i wriet this code?
Private Sub Option16_AfterUpdate()
If Me.ogrMyOptionGroup = 1 Then
<OPtion Button Is Selected>
& if itis not What is the right code?
 
hi John

thank you for reply I did understand you verey well, but now my qustion to
you is

when i selecet an Option Button it's number was 16 and the othere was 19
..... be with me in that!!!! ok frist! Is there is worng in that?

You should use the AfterUpdate event *OF THE OPTION GROUP CONTROL* -
not the afterupdate event of each button in that control.

Private Sub ogrMyOptionGroup_AfterUpdate()
If Me!obrMyOptionGroup = 16 Then
<do something appropriate if button 16 was clicked>
End If

or, more commonly,

Select Case Me!obrMyOptiongroup
Case 1
<do something appropriate for option 1>
Case 2
<and so on and so on...
....
End Select

John W. Vinson[MVP]
 
OK THANK YOU VEREY MUCH I WILL TRY THIS

John Vinson said:
You should use the AfterUpdate event *OF THE OPTION GROUP CONTROL* -
not the afterupdate event of each button in that control.

Private Sub ogrMyOptionGroup_AfterUpdate()
If Me!obrMyOptionGroup = 16 Then
<do something appropriate if button 16 was clicked>
End If

or, more commonly,

Select Case Me!obrMyOptiongroup
Case 1
<do something appropriate for option 1>
Case 2
<and so on and so on...
....
End Select

John W. Vinson[MVP]
 
Back
Top