There is not a "group" object as you seem to want to use.
Dim obtn as MSforms.OptionButton
Dim cntrl as Control
set obtn = nothing
for each cntrl in Userform1.Frame1.Controls
if typeof cntrl is MSforms.OptionButton then
if cntrl.groupname = "TaxGroup" then
if cntrl then
set obtn = cntrl
exit for
end if
end if
end if
Next
if not obtn is nothing then
Select Case obtn.Name
Case "OptionButton1": txtTax.Value = "Includes"
Case "OptionButton2": txtTax.Value = "Excludes"
Case "OptionButton3": txtTax.Value = "Non Taxable"
End Select
Else
msgbox "None Selected"
End if
you can take out the check for TaxGroup if those are the only option buttons
in the frame.
--
Regards,
Tom Ogilvy
"Garry" wrote in message
...
I have a frame containing three optionbuttons. I have set the groupname
in the properties inspector manaually to "TaxGroup".
How do i reference this ie get the value or a value of it. Could I use
the select case statement to then action on which optionbutton is true.
Select Case Controls("TaxGroup").Value
Case Is = 1
Case "OptionButton1": txtTax.Value = "Includes"
Case "OptionButton2": txtTax.Value = "Excludes"
Case "OptionButton3": txtTax.Value = "Non Taxable"
End Select
garry
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!