Option Groups

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

Guest

I have a form that has MANY option groups. If one of the "Header" option
groups is checked N/A then I want all the ones that appear under it to be
automatically checked N/A also. I tried this code but it didn't work:

Private Sub Frame109_AfterUpdate()
If Frame109.Value = 6 Then
Frame117.Value = 6
Frame125.Value = 6
Frame133.Value = 6
Frame141.Value = 6
End If

End Sub

I think I need to make it so that the Option button associated with N/A is
selected then the other ones I want to select will also. But I can't figure
out how to determine if that one is selected? HELP!
 
Larry G. said:
I have a form that has MANY option groups. If one of the "Header"
option groups is checked N/A then I want all the ones that appear
under it to be automatically checked N/A also. I tried this code but
it didn't work:

Private Sub Frame109_AfterUpdate()
If Frame109.Value = 6 Then
Frame117.Value = 6
Frame125.Value = 6
Frame133.Value = 6
Frame141.Value = 6
End If

End Sub

In what way does the code "not work"? There's nothing inherently wrong
with the code, so far as I can see, but it may not give the results you
want if 6 is not the "N/A" option value for all those groups, and it
will fail if you have the wrong name for any of the option group frames.
Also, the code will only run when Frame109 is actually changed by the
user.
I think I need to make it so that the Option button associated with
N/A is selected then the other ones I want to select will also. But I
can't figure out how to determine if that one is selected? HELP!

Is 6 not the option value for the "N/A" choice for Frame109? How did
you arrive at the number 6? If you open the form in design view and
bring up the property sheet for the "N/A" option button, check box, or
whatever type of control it is (within the option group frame), then the
Option Value property (on the Data tab of the property sheet, I believe)
will tell you the numeric value that corresponds to that option.
 
The problem is that when I select the N/A option in the Header frame, none of
the other frames change, so obviously something is wrong somewhere.
 
Larry G. said:
The problem is that when I select the N/A option in the Header frame,
none of the other frames change, so obviously something is wrong
somewhere.

Do all the other option groups have the same number of options, with the
same option values assigned to each?
 
Larry G. said:
Yes - they are essentially copied and pasted with a different name

Make sure that the control is connected to the event procedure code, by
ensuring that the AfterUpdate property on the Event tab of its property
sheet is set to "[Event Procedure]". The event procedure won't be
called if this property is not set that way. Certain actions, such as
cutting and pasting the control, can cause controls to get disconnected
from their event procedures.
 
Back
Top