Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OptionButton groups - determining active member

Status
Not open for further replies.

PinkeyNBrain

IS-IT--Management
Dec 12, 2006
279
0
0
US
I'm actually using Excel versus Access. Can't find an excel specific forum, hoping there is enough overlap to validly post here:

- Have a basic form (call fUsrOpts) with a handful of OptionButtons broken down into different GroupNames (eg. "camera_num", "lens_filter").

- I'm looking for a practical way to determine which OptionButton from a group is set to True.

- Right now I have a routine which I pass a string that represents a group name. The routine loops over Me.Controls until it finds a .GroupName property that matches what was passed in. It then looks to see if it's .Value is set to True. If so, that button reference is passed back. This works, but it seems clumsy to me.

- Does anyone have a more elegant solution?

Side note: I'm currently writing under MSOffice 2003. My company is scheduled to goto 2010 later this year (3rd or 4th qtr). So if there is a difference in solutions based off of Office version, I'm open to both.

If there is a more appropriate forum to post this in, sorry for the hassle here and please redirect me. I looked for an Excel specific forum and did not find one.
 
Do not work with the individual options, but with the group frame. The value of the frame is the selected button.
Usually done in conjunction with a select case

select case me.frmFilters
Case 1
some code if first selection choosen
case 2
2nd choosen
case 3
end select

Off the top of my head I do not remember if the option group are zero or one based. So if you have three options the value may be 0-2, not 1-3. Please check.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top