Text box visible after clicking option button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to code my form to allow a text box to become visible only after
an option button is chosen. I also want the text box to be hidden again, if
the user changes their option. There is a different text box for each of my
three options.
 
Presumably, this option button is part of an option group? If so, use the
AfterUpdate event of the group, and test the value of the group to see if it
is the button you are interested in.

Private Sub Frame0_AfterUpdate
Me.Text1.Visible = Nz(Me.Frame0 = Me.Opt2.OptionValue, False)
End Sub
 
If I understand you correctly, you have 3 textboxes and 1 option group with
three options. When option 1 is selected, you want textbox1 visible and
textbox2 and textbox3 invisible. Assuming I understand the question, in the
After Update event of the Option Group:

Me.TextBox1.visible = Me.OptionGroup = 1
Me.TextBox2.visible = Me.OptionGroup = 2
Me.TextBox3.visible = Me.OptionGroup = 3
 
Same way.
Me.TextBox1.visible = Me.OptionGroup = 1
Me.Label1.visible = Me.OptionGroup = 1
Me.TextBox2.visible = Me.OptionGroup = 2
Me.Label2.visible = Me.OptionGroup = 2
Me.TextBox3.visible = Me.OptionGroup = 3
Me.Label3.visible = Me.OptionGroup = 3

(of course you will have to change the names to match your controls)
 
The label attached to the text box will automatically hide and show with the
text box.

Try it.
 
Provided it is attached, you are correct. Since that question was a follow
on, I assumed her's are not attached.
 
Back
Top