Hiding Labels

  • Thread starter Thread starter mickiedevries
  • Start date Start date
M

mickiedevries

I'm using user forms to build a program and I want some radio button
hidden based on what the user selects on a previous form. I know yo
can set the radio button's visible property to false or true on th
form however I'm not sure how to change the visible property based o
what a user selects on a different form. For example my userForm1 ask
a user to select from different options in radio buttons, depending o
the selection UserForm1 sends the user to UserForm2, but also dependin
on the selection I only want certain options in radio buttons t
display so a user can only select further options that directly pertai
to the previous choices.

I know I could use different forms for each selection but I think thi
will make the program overly confusing and I would like to limit m
total user forms by hiding inappropriate choices based on the previou
choices.

Thanks for any help!

Micki
 
Something like this in userform2:-

Code
-------------------

Private Sub UserForm_Activate()
Me.OptionButton1.Visible = _
IIf(UserForm1.TextBox1.Value = "", False, True)
End Sub

-------------------


To read a value from a userform it has to be live. So in userform1 an
2 you will use something like :-

Code
-------------------

Private Sub CommandButton1_Click()
Me.Hide
UserForm2.Show
End Sub
 
Could you break down this code for me and tell me what each part i
doing (mainly the False True part)? I'm trying to use an option box o
UserForm1 and I'm not sure how to use what you have to accomplis
that.

Private Sub UserForm_Activate()
Me.OptionButton1.Visible = _
IIf(UserForm1.TextBox1.Value = "", False, True)
End Sub

For instance I want to have the optionbutton on UserForm2 not visibl
if the optionbutton on UserForm1 was selected.

Thanks again,

Micki
 
It is a shorthand version of this - which is what you want :-


Code
-------------------
'- userform 2 code
Private Sub UserForm_Activate()
If UserForm1.OptionButton1.Value = True Then
Me.OptionButton1.Visible = False
Else
Me.OptionButton1.Visible = True
End If
 

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

Similar Threads

Radio buttons: "mutually exclusive" property? 2
Userform picture 1
Access create a form calling macros 2
Hiding a form 4
Forms and WorkSheets 1
Radio Button output 3
radio button help 3
Administration Form with Radio Controls 1

Back
Top