PC Review


Reply
Thread Tools Rate Thread

control the Visible Property on sections of a UserForm with a macro

 
 
RJQMAN@gmail.com
Guest
Posts: n/a
 
      2nd Jun 2009
I have userforms, each with 8 pairs of radio buttons (Yes-No
options). In many cases, the user will not need all eight sets -
perhaps only six of the eight apply, for example. Therefore I would
like to hide different pairs of the radio buttons, depending on input
from the user before the userform is loaded.

Each pair of buttons is inside of a frame, and the title for the
buttons is a text box that draws the title from other entries made by
the user.

Can I make the frame invisible and thereby everything inside of the
frame as well? That would be ideal, but I have no idea how to
structure a macro to change the property of the frame (or to change
the properties of the textbox and/or radio buttons).

For example, if I want to hide the two radio buttons and text box
inside of frame 7, depending on an integer that was selected in an
earlier part of the program, the concept would be;

If Integer1=1 then UserForm4, Frame 7 visible = false
If Integer1=2 then userform4.frame7.visible=true.

Is there a way to do this? Thanks for the assistance. I am lost here.
 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      2nd Jun 2009
Your code is almost right. You didn't say where Integer1 is, what changes
its value, and when it should toggle visibility of the frame.

Lets say Integer1 is a public in a normal module and set before the form
loads

Private Sub UserForm_Initialize()
Me.Frame7.Visible = (Integer1 = 2)
End Sub


or maybe you might want to control it from as you load the form

Sub test()
Dim Integer1 As Long

Integer1 = 0
' form loads into memory 1st time it's referenced
UserForm1.Frame7.Visible = (Integer1 = 2)
UserForm1.Show

End Sub

Personally, rather than Integer1 = 1 or 2, why not 0 or 1. Perhaps a Boolean
flag
bOptions7 = True/False

Regards,
Peter T


<(E-Mail Removed)> wrote in message
news:3ae65b3b-43d5-4b36-a18a-(E-Mail Removed)...
>I have userforms, each with 8 pairs of radio buttons (Yes-No
> options). In many cases, the user will not need all eight sets -
> perhaps only six of the eight apply, for example. Therefore I would
> like to hide different pairs of the radio buttons, depending on input
> from the user before the userform is loaded.
>
> Each pair of buttons is inside of a frame, and the title for the
> buttons is a text box that draws the title from other entries made by
> the user.
>
> Can I make the frame invisible and thereby everything inside of the
> frame as well? That would be ideal, but I have no idea how to
> structure a macro to change the property of the frame (or to change
> the properties of the textbox and/or radio buttons).
>
> For example, if I want to hide the two radio buttons and text box
> inside of frame 7, depending on an integer that was selected in an
> earlier part of the program, the concept would be;
>
> If Integer1=1 then UserForm4, Frame 7 visible = false
> If Integer1=2 then userform4.frame7.visible=true.
>
> Is there a way to do this? Thanks for the assistance. I am lost here.



 
Reply With Quote
 
RJQMAN
Guest
Posts: n/a
 
      4th Jun 2009
On Jun 2, 4:21*am, "Peter T" <peter_t@discussions> wrote:
> Your code is almost right. You didn't say where Integer1 is, what changes
> its value, and when it should toggle visibility of the frame.
>
> Lets say Integer1 is a public in a normal module and set before the form
> loads
>
> Private Sub UserForm_Initialize()
> * * Me.Frame7.Visible = (Integer1 = 2)
> End Sub
>
> or maybe you might want to control it from as you load the form
>
> Sub test()
> Dim Integer1 As Long





>
> Integer1 = 0
> ' form loads into memory 1st time it's referenced
> UserForm1.Frame7.Visible = (Integer1 = 2)
> UserForm1.Show
>
> End Sub
>
> Personally, rather than Integer1 = 1 or 2, why not 0 or 1. Perhaps a Boolean
> flag
> bOptions7 = True/False
>
> Regards,
> Peter T
>
> <RJQ...@gmail.com> wrote in message
>
> news:3ae65b3b-43d5-4b36-a18a-(E-Mail Removed)...
>
>
>
> >I have userforms, each with 8 pairs of radio buttons (Yes-No
> > options). * In many cases, the user will not need all eight sets -
> > perhaps only six of the eight apply, for example. *Therefore I would
> > like to hide different pairs of the radio buttons, depending on input
> > from the user before the userform is loaded.

>
> > Each pair of buttons is inside of a frame, and the title for the
> > buttons is a text box that draws the title from other entries made by
> > the user.

>
> > Can I make the frame invisible and thereby everything inside of the
> > frame as well? *That would be ideal, but I have no idea how to
> > structure a macro to change the property of the frame (or to change
> > the properties of the textbox and/or radio buttons).

>
> > For example, if I want to hide the two radio buttons and text box
> > inside of frame 7, depending on an integer that was selected in an
> > earlier part of the program, the concept would be;

>
> > If Integer1=1 then UserForm4, Frame 7 visible = false
> > If Integer1=2 then userform4.frame7.visible=true.

>
> > Is there a way to do this? *Thanks for the assistance. *I am lost here.- Hide quoted text -

>
> - Show quoted text -



Wow. That works very well. Thank you for your help. I greatly
appreciate it. Have a wonderful day.
 
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
Visible Property of Control on a Report JD McLeod Microsoft Access Reports 1 7th Aug 2008 10:54 PM
Set Visible property of various sections in a report thru VBA =?Utf-8?B?S3BhdGVs?= Microsoft Access Reports 5 4th Apr 2006 04:52 AM
Work around control.Visible property =?Utf-8?B?VGhlIEdyYXBlIEh1bnRlcg==?= Microsoft Access Queries 4 10th Nov 2005 11:36 PM
Keep userform visible, but return control to calling routine Ryan Poth Microsoft Excel Programming 0 21st Aug 2003 05:28 AM
visible control property brian Microsoft Access VBA Modules 2 7th Aug 2003 05:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:55 AM.