[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1135
  • Last Modified:

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.

0
schmir1
Asked:
schmir1
  • 2
1 Solution
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:

  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)PresidentCommented:

  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
 
schmir1Author Commented:
Thanks.  I had a mental block about the Frame being the Group.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now