PC Review


Reply
Thread Tools Rate Thread

cycle thru controls

 
 
=?Utf-8?B?SlQ=?=
Guest
Posts: n/a
 
      10th Sep 2007
My multitab user form as 8 tabs. Each tab has a different number of radio
buttons. Is there an easy way to cycle through all of the radio buttons on a
single tab to find the one that has been selected?

Currently I'm, writing an "if" statement for each radio button but this
seems cumbersome.

Thanks.......
--
JT
 
Reply With Quote
 
 
 
 
cwrm4@yahoo.com
Guest
Posts: n/a
 
      10th Sep 2007
On Sep 10, 5:02 pm, JT <J...@discussions.microsoft.com> wrote:
> My multitab user form as 8 tabs. Each tab has a different number of radio
> buttons. Is there an easy way to cycle through all of the radio buttons on a
> single tab to find the one that has been selected?
>
> Currently I'm, writing an "if" statement for each radio button but this
> seems cumbersome.
>
> Thanks.......
> --
> JT


The below is some code I have for cycling through the controls in a
frame (in this case to disable/enable). You could modify to only look
for radiobuttons that = true.

Sub EnableFrame(InFrame As Frame, ByVal Flag As Boolean)
Dim Contrl As Control
'some controls don't have the Container.Name property, so instead of
'stopping the application with an error message, we ignore them.
On Error Resume Next
'enable or disable the frame that passed as parameter.
InFrame.Enabled = Flag
'passing over all controls
For Each Contrl In InFrame.Parent.Controls
'if the control is found in the frame
If (Contrl.Container.Name = InFrame.Name) Then
'if the control is a frame, and it's not the frame that passed as
parameter, i.e.
'other frame that found inside our frame, recursively run this sub
with this frame,
'to enable or disable all the controls in it.
If (TypeOf Contrl Is Frame) And Not (Contrl.Name =
InFrame.Name) Then
EnableFrame Contrl, Flag
Else
'enable or disable the control
If Not (TypeOf Contrl Is Menu) Then Contrl.Enabled = Flag
End If
End If
Next
End Sub

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      10th Sep 2007
This checks Page3 of the mulripage

With MultiPage1.Pages(2)
For Each ctl In .Controls
If TypeName(ctl) = "OptionButton" Then
If ctl.Value Then
MsgBox ctl.Name
Exit For
End If
End If
Next ctl
End With


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"JT" <(E-Mail Removed)> wrote in message
news:F6AB266A-0513-4FFB-A747-(E-Mail Removed)...
> My multitab user form as 8 tabs. Each tab has a different number of radio
> buttons. Is there an easy way to cycle through all of the radio buttons
> on a
> single tab to find the one that has been selected?
>
> Currently I'm, writing an "if" statement for each radio button but this
> seems cumbersome.
>
> Thanks.......
> --
> JT




 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cycle through Controls on form =?Utf-8?B?QnJhZA==?= Microsoft Access Form Coding 4 28th May 2007 07:07 PM
Cycle through some controls and unlock =?Utf-8?B?Ulc=?= Microsoft Access Form Coding 3 22nd May 2007 10:37 PM
Cycle through controls =?Utf-8?B?cG9saXNjaSBncmFk?= Microsoft Access Forms 3 6th Jul 2006 08:24 PM
VBA - cycle through controls julie@hcts.net.au Microsoft Powerpoint 2 13th Jul 2005 01:40 AM
cycle through controls to get value tim johnson Microsoft Access Forms 2 15th Dec 2003 10:27 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:19 AM.