Deselect All Option Groups

G

Guest

I have about 20 Option Groups on a subform. I noticed that once a user
selects one of the 2 options, they cannot reset the Option Group to
"Unselected". How can I create a Command Button that will allow the user to
"Deselect" ALL of the Option Groups on the form without me having to create
20 separate command buttons.

Thanks.

- Steve
 
A

Allen Browne

Loop through the controls on the form. If its ControlType indicates it is an
option group, set its value to null:

Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acOptionGroup Then
ctl = Null
End If
Next
Set ctl = Nothing
 
G

Guest

That worked! Thanks so much.

- Steve


Allen Browne said:
Loop through the controls on the form. If its ControlType indicates it is an
option group, set its value to null:

Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acOptionGroup Then
ctl = Null
End If
Next
Set ctl = Nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top