comparing multiple option groups

  • Thread starter Thread starter kathy
  • Start date Start date
K

kathy

I have several option groups in a form. If any buttons
are selected within a group, can it automatically select
a 'group button' or is there some way that I could query
to test to see if anything within the group was selected?
 
Hi Kathy,

The selection value in an option group is assigned to the option group
frame. To demonstrate how you can find out the value of the selection, here
is some sample code:

Private Sub Frame0_AfterUpdate()
MsgBox "You selected " & Me.Frame0
End Sub

I have just put the result into a message box but you can do what you like
with it. You simply reference the value of the frame control at the point
in time you need to. In this example I wanted to know the value as soon as
the frame control was updated (that is, the user clicked one of the option
buttoms), but I could refer to it at any point during runtime to find it's
value. For example, if I wanted to know what was selected before I
performed some other action I could use:

Select Case Frame0 'Let's pretend there are 3 items
Case 1
'Code here in response to the user selecting this value
Case 2
'Code here in response to the user selecting this value
Case 3
'Code here in response to the user selecting this value
Case Else
'User hasn't selected one of the options - Code here for that
(if required)
End Select

The "Case" items correspond to the value of the option in the group. You
can check these values in the property sheet of the specific control at
design time.

Hope this helps.


All Unsolicited email is deleted.
 
Back
Top