Option Groups and Select Case

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Greetings,
I'm currently setting up a script that will select an array based on
specific criteria. I'm using the select case method. The problem is that I
want the user to select a radio button and the value of that radio button
will determine the array to use.

I have the 5 options buttons named optOne, optTwo, etc...
I have one frame named fraFormat
The option buttons are part of the group grpFormat

At the bottom of the form I have a button that is named cmdFormat

I have this function that will assign values to an array

Function Selection(OpUnitFormat)

Select Case OpUnitFormat
Case 1
strOpUnitProd(1) = ""
strOpUnitProd(2) = ""
strOpUnitProd(3) = ""
strOpUnitProd(4) = ""
strOpUnitProd(5) = ""

Case 2
strOpUnitProd(1) = ""
strOpUnitProd(2) = ""
strOpUnitProd(3) = ""
strOpUnitProd(4) = ""
strOpUnitProd(5) = ""

Case 3
strOpUnitProd(1) = ""
strOpUnitProd(2) = ""
strOpUnitProd(3) = ""
strOpUnitProd(4) = ""
strOpUnitProd(5) = ""

Case 4
strOpUnitProd(1) = ""
strOpUnitProd(2) = ""
strOpUnitProd(3) = ""
strOpUnitProd(4) = ""
strOpUnitProd(5) = ""

Case 5
strOpUnitProd(1) = ""
strOpUnitProd(2) = ""
strOpUnitProd(3) = ""
strOpUnitProd(4) = ""
strOpUnitProd(5) = ""

End Select
End Function

*******************************
What am I doing wrong with the following:
*******************************

Private Sub cmdFormat_Click()
Call Selection(fraFormat.ActiveControl.TabIndex)

End Sub

Is there a better way to do this? Thanks for any help.
 
Functions return values, objects, or other data structures. Try changing
your function to a Sub.

Also, I would be wary about using Selection as a procedure name as VBA has a
Selection object - could cause confusion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top