How to test Option Group values with VBA

How do I use VBA to find the value of an option group?  Can you give me an example using two options.

schmir1Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:

  Not sure I understand the question.  If you have an option group, you simply refer to the group control:

  Me.<name of my group control>

  To get it's value.

JimD.
0
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:

  and to be clear, you replace everything in the <> with the actual name of the control.  For example, if the control was named grpReportType, then you'd use:

  If Me.grpReportType = 3 then
    ' do this report
  ElseIf Me.grpReportType = 2 then
    ' do that report
  Else
     MsgBox "Invalid report type"
  End If

  An alternative to the above would be to use a Select CASE statement

  Select Case grpReportType

  Case 3
     ' do this report
  Case 2
     ' do that report
  Case Else
     MsgBox "Invalid report type"
  End Select

JimD.
 
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
schmir1Author Commented:
Thanks.  I had a mental block about the Frame being the Group.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.