OptionButton - Unable to set names properly within Frame

OptionButton - Unable to set names properly within Frame

Anonymous
Not applicable
254 Views
3 Replies
Message 1 of 4

OptionButton - Unable to set names properly within Frame

Anonymous
Not applicable
I am getting an error when I try to set multiple OptionButton names to the same name (within a frame) on a UserForm. The message I get is "Could not set the name property. Ambiguous Name."
I want to be able to use this as a Control Array, so the OptionButton names within the frame should have the same name......is this not correct.
I would appreciate any help here....thanks
John V.
0 Likes
255 Views
3 Replies
Replies (3)
Message 2 of 4

Ed__Jobe
Mentor
Mentor
vba does not support control arrays. I have worked around that in the past by using incremental alphanumeric names, i.e Control001, Control002, etc. I then examined the number portion of the name. I used this technique to create a number of textboxes at runtime according to the number of text items in the selection set.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 4

Anonymous
Not applicable
Thanks for the info.
Taking your example, I've been able to do the work around using an IF statement within the click-event of the OptionButton. Each button would need the IF.
You still need to keep the OptionButtons within a frame to treat them as a group. It works so far, so I'll keep it.
ie:

If optBtn1.Value = "True" Then
....code.....
End If

thx.
JV
0 Likes
Message 4 of 4

Anonymous
Not applicable
John,

 

I emulate a control array in VBA forms by using the frame's
Tag:

 

Private Sub optFull_Click()
  fraSF.Tag = 1#
End
Sub

 

Private Sub optHalf_Click()
  fraSF.Tag = 2#
End
Sub

 

Private Sub optEighth_Click()
  fraSF.Tag = 96#
End
Sub

 

HTH


--
R.
Robert Bell, MCSE
www.AcadX.com

 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Thanks
for the info.
Taking your example, I've been able to do the work around
using an IF statement within the click-event of the OptionButton. Each button
would need the IF.
You still need to keep the OptionButtons within a frame
to treat them as a group. It works so far, so I'll keep it.
ie:

If optBtn1.Value = "True" Then

        ....code.....

    End If

thx.
JV

0 Likes