Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here is the answer using a macro that runs on a button on the same form, and it returns the the value for the active radio button in a message box. The below checks the state of each button and returns the reference of the activated button. For demonstration, it completes using the SecondaryRefValue but for just one button on assumption that if none are active all are inactive with the same secondary reference value, as you say in your question.

Sub radio (eventObj As Object)
  REM Dim srcObj, buttonObj, parFrm As Object
  Dim valStr As String

  srcObj = eventObj.Source
  buttonObj = srcObj.model
  parFrm = buttonObj.parent

  radCtrl3 = parFrm.getByName("Option3")
  radCtrl2 = parFrm.getByName("Option2")
  radCtrl1 = parFrm.getByName("Option1")

  REM MsgBox radCtrl3.dbg_methods
  If radCtrl1.State = 1 Then 
    valStr = radCtrl1.RefValue
  ElseIf radCtrl2.State = 1 Then 
    valStr = radCtrl2.RefValue
  ElseIf radCtrl3.State = 1 Then 
    valStr = radCtrl3.RefValue
  ElseIf radCtrl1.State = 0 Then 
    valStr = radCtrl1.SecondaryRefValue
  End If

  MsgBox valStr

End Sub

(if this answers your question please accept the answer by clicking the check (image description) to the left)